一乐电子

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

QQ登录

只需一步,快速开始

微信扫码登录

手机号码,快捷登录

手机号码,快捷登录

搜索
查看: 2482|回复: 5

linux安装wxpython

[复制链接]
发表于 2017-1-31 15:43 | 显示全部楼层 |阅读模式
curl http://apt.wxwidgets.org/key.asc | sudo apt-key add - sudo apt-get update   l4 F+ J4 ]& ]) p3 |
sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n) A" L# T8 C" o# h
2 e7 k8 D( V! Z" w3 v
sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n libwxgtk2.8-dev libgtk2.0-dev, A( C# }$ C, [1 n( @/ a- E9 q

4 i. N% i2 y4 |- T* C0 g
 楼主| 发表于 2017-1-31 15:44 | 显示全部楼层
   1 import wx
: n9 j8 @& f$ W' |/ R/ M/ S   2 ' o6 p2 Z1 W. _% y8 D) d3 ?
   3 class MainWindow(wx.Frame):* l( `6 i' M3 h! T
   4     def __init__(self, parent, title):$ ^$ c6 s2 d" v2 _: Z0 {! W
   5         wx.Frame.__init__(self, parent, title=title, size=(200,100))
2 s, Z0 X8 s. d) |   6         self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
, b7 m7 u1 ^1 y& B7 u0 `: a# \   7         self.CreateStatusBar() # A Statusbar in the bottom of the window4 c8 c4 K2 t9 G4 \: a, Z
   8
. X5 ~( Q( {, P" r   9         # Setting up the menu.
) p3 {6 D7 a$ [; E( U9 b  10         filemenu= wx.Menu()+ g* Z3 S' T+ M" t0 N
  11 1 |; k0 L4 g0 L9 \! `; ]3 i
  12         # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.5 F  m/ k) t' w
  13         filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
. o5 I. y# o) X0 D  14         filemenu.AppendSeparator()  ~& M- v  t$ E, S$ N+ m0 o
  15         filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")
* c7 h, m0 E: V4 a3 u  16
! @+ w7 H6 ?' _& b  17         # Creating the menubar., B: D! \2 }, w1 u5 T8 `7 i" E
  18         menuBar = wx.MenuBar()
2 D" ~1 y# R) y' z- X) ?  19         menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar1 B3 N/ Y/ q! d" s- k
  20         self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.2 u) ~9 v4 V$ b" S# F( u* ]9 M
  21         self.Show(True)
6 N2 E5 f& u9 i* h- s9 b/ O6 Y  22
8 v" y4 ?& }2 M, t2 F6 V  23 app = wx.App(False)7 Z  V! e, O' M# ?* r4 s' F  @
  24 frame = MainWindow(None, "Sample editor")" z/ b* B( L. q3 }, S/ C- p- ]
  25 app.MainLoop()
回复

使用道具 举报

 楼主| 发表于 2017-1-31 15:46 | 显示全部楼层
运行效果
/ M" S: ^1 o( p0 G hello.png
( b! F/ A( m% B8 `
回复

使用道具 举报

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

使用道具 举报

发表于 2017-2-1 08:42 | 显示全部楼层
没看明白,能否稍加解释?
8 d  m' V3 {9 U4 v1 X: [谢谢!
回复

使用道具 举报

 楼主| 发表于 2017-2-1 11:48 | 显示全部楼层
yanjian 发表于 2017-2-1 08:42
+ O& x" [0 K0 ^& W% H0 O没看明白,能否稍加解释?% i+ g$ Z% i+ o% ^! y! F  Q, n1 s
谢谢!

8 b1 w% ~1 \5 P其实没什么东西来的,只不过是一些安装这个软件的步骤,这个没必要看明啊,了解就行。$ f7 @( \; t' }
回复

使用道具 举报

本版积分规则

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

GMT+8, 2026-4-19 18:29 , Processed in 0.038280 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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