一乐电子

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

QQ登录

只需一步,快速开始

微信扫码登录

手机号码,快捷登录

手机号码,快捷登录

搜索
查看: 2480|回复: 5

linux安装wxpython

[复制链接]
发表于 2017-1-31 15:43 | 显示全部楼层 |阅读模式
curl http://apt.wxwidgets.org/key.asc | sudo apt-key add - sudo apt-get update
/ _4 V6 Z3 |) U! n5 z: n sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n
  @6 W$ A: ]" Y7 C" s* h% V9 o/ I: Z) U4 |' W4 d3 J
sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n libwxgtk2.8-dev libgtk2.0-dev) O; }" K. Z: [: c8 j9 T

6 K2 V- ]/ B6 P4 Z4 I# O, E
 楼主| 发表于 2017-1-31 15:44 | 显示全部楼层
   1 import wx; b- \( K) h# M! A7 N+ v
   2
2 e4 V/ D+ }+ M0 L" Q   3 class MainWindow(wx.Frame):- W4 X. h( \3 b2 M6 y& n, Z, [
   4     def __init__(self, parent, title):9 h1 z9 b2 r: C0 y6 O) q8 C
   5         wx.Frame.__init__(self, parent, title=title, size=(200,100))& @8 U3 D- a% Y5 ]
   6         self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
1 g3 a+ z. U( h0 ]# _   7         self.CreateStatusBar() # A Statusbar in the bottom of the window% Y! ^! X( z3 u: I* A8 t6 }5 @
   8
& M9 e: u- u7 d/ }9 x   9         # Setting up the menu.: y$ f# @; [* I6 G; V$ y
  10         filemenu= wx.Menu()$ C) M: _& |3 ?7 m8 R! O6 [) t1 H
  11 . i7 ]& I: h1 B$ P0 ?1 R) z* l
  12         # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.1 _' b( _5 c- D+ y
  13         filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")6 u3 H0 ^+ o/ D* z  ?
  14         filemenu.AppendSeparator()
0 O) S: P6 \+ @; g4 |) j' U  15         filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")+ P$ B0 E& [5 R/ v
  16
( P2 m  C7 Y3 r: X  17         # Creating the menubar.
: Q+ p3 F1 W% u' B  18         menuBar = wx.MenuBar()+ F3 l0 \2 X' ?/ E7 X2 o9 @* {% u
  19         menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar# G; v$ F# O! C+ t1 n
  20         self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.
, e: ]* Q8 m0 |% x$ R/ \- e  21         self.Show(True)- C* a$ Z& B1 {- Q3 {* h
  22
! N' V3 M! E2 h' l  23 app = wx.App(False)
8 B( \9 G( d8 O, r; z  24 frame = MainWindow(None, "Sample editor")
3 t3 Q+ X7 A' w1 \8 y0 \( I  25 app.MainLoop()
回复

使用道具 举报

 楼主| 发表于 2017-1-31 15:46 | 显示全部楼层
运行效果
$ Y% ]0 w: a; d( ^" C& J hello.png , a( @$ g, c) U- x# O5 |
回复

使用道具 举报

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

使用道具 举报

发表于 2017-2-1 08:42 | 显示全部楼层
没看明白,能否稍加解释?4 s% q. r( L  M; V0 Q4 I7 T9 w# ?% E
谢谢!
回复

使用道具 举报

 楼主| 发表于 2017-2-1 11:48 | 显示全部楼层
yanjian 发表于 2017-2-1 08:429 C( s5 c- F6 Y/ f1 d
没看明白,能否稍加解释?. t5 U2 h/ N& s6 P# Q
谢谢!

+ g6 `7 N* ~3 Z6 V3 [3 K+ H其实没什么东西来的,只不过是一些安装这个软件的步骤,这个没必要看明啊,了解就行。8 d0 S8 S) K2 j+ D) ^) _2 Y1 R
回复

使用道具 举报

本版积分规则

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

GMT+8, 2026-4-17 17:23 , Processed in 0.036367 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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