一乐电子

 找回密码
 请使用微信账号登录和注册会员

QQ登录

只需一步,快速开始

微信扫码登录

搜索
查看: 2181|回复: 5

linux安装wxpython

[复制链接]
发表于 2017-1-31 15:43 | 显示全部楼层 |阅读模式
curl http://apt.wxwidgets.org/key.asc | sudo apt-key add - sudo apt-get update ' W8 e6 ?9 K5 Y4 M- x; ?, T* a
sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n2 n' c& U1 ]! y2 b/ \

! ^2 W! l/ ]6 z' l$ E- ^! B$ E' psudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n libwxgtk2.8-dev libgtk2.0-dev  ]) H/ _& h+ |3 h+ U  \8 A4 o

$ X+ `$ n3 z% V" L  X
 楼主| 发表于 2017-1-31 15:44 | 显示全部楼层
   1 import wx
* `  Q* y5 K/ f+ B2 x! ~+ y   2
3 t1 E) n0 [! u* r: d/ ]7 [3 F; Q5 j' V   3 class MainWindow(wx.Frame):1 _0 O% l7 s  T0 L
   4     def __init__(self, parent, title):
- O' [( o% G- n1 y" T; `2 Q: V   5         wx.Frame.__init__(self, parent, title=title, size=(200,100))" t2 @, |1 [$ }, I7 b& _
   6         self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)2 J5 b# Z: T7 v4 e( C* i9 D
   7         self.CreateStatusBar() # A Statusbar in the bottom of the window
! g1 t! q+ _. W  s. G. k   8 / x$ E7 N: J' g* h  c
   9         # Setting up the menu.; L2 j: e& S+ m
  10         filemenu= wx.Menu()  A# ?% [6 y8 F1 L
  11
, {/ [3 p+ Y7 p4 }4 S  12         # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.
. b9 G' ]. s9 R% }+ q  13         filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
  L& m/ K+ m: i& Q1 u1 n. Y; g1 p* O  14         filemenu.AppendSeparator()
* ]3 P8 O% F: B6 \  15         filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")
* C7 t0 S- h4 l" A6 \9 x8 H/ \9 F  o  16
5 a& ~% L5 L- C& K% m6 n  e  17         # Creating the menubar., b, j: L  x. {- ?+ l/ B4 E% ^
  18         menuBar = wx.MenuBar()
/ [) b' D" B: U7 ~; k  19         menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar
3 w! x# A& T8 G+ W# y9 b  20         self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.8 w( v* y1 H& i0 U7 U
  21         self.Show(True)" Z8 B  M5 z. E
  22 ' k: R! b5 f) i6 S0 |* c! M
  23 app = wx.App(False)& M- k/ |: h# C- C
  24 frame = MainWindow(None, "Sample editor")$ K0 R2 ~$ L" Z4 i3 x: R
  25 app.MainLoop()
回复

使用道具 举报

 楼主| 发表于 2017-1-31 15:46 | 显示全部楼层
运行效果) q$ O' y1 g0 G) f* c1 V7 B
hello.png 9 m4 X$ I5 N- D
回复

使用道具 举报

 楼主| 发表于 2017-1-31 15:47 | 显示全部楼层
小小TESTED 如果有DX 请多多指教
回复

使用道具 举报

发表于 2017-2-1 08:42 | 显示全部楼层
没看明白,能否稍加解释?, j8 |; j! y7 {" e/ s- J  l
谢谢!
回复

使用道具 举报

 楼主| 发表于 2017-2-1 11:48 | 显示全部楼层
yanjian 发表于 2017-2-1 08:42
) f/ F0 U2 H% ~  T没看明白,能否稍加解释?
8 u( [& c  O& ?谢谢!
( i$ i5 H4 R" @9 A4 F2 Q- ~/ q
其实没什么东西来的,只不过是一些安装这个软件的步骤,这个没必要看明啊,了解就行。: D4 K7 \+ B' v  t
回复

使用道具 举报

本版积分规则

QQ|一淘宝店|手机版|商店|一乐电子 ( 粤ICP备09076165号 ) 公安备案粤公网安备 44522102000183号

GMT+8, 2025-8-20 09:00 , Processed in 0.040623 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表