一乐电子

一乐电子百科

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

QQ登录

只需一步,快速开始

快捷登录

手机号码,快捷登录

搜索
查看: 2089|回复: 5
收起左侧

linux安装wxpython

[复制链接]
发表于 2017-1-31 15:43 | 显示全部楼层 |阅读模式
curl http://apt.wxwidgets.org/key.asc | sudo apt-key add - sudo apt-get update
& \3 u  d/ L; w: g) u) o. ~ sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n& V6 R: o' s: F) h0 W& {3 k

% f- V! \$ _" vsudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n libwxgtk2.8-dev libgtk2.0-dev
5 L5 i0 E% y5 |6 [) D* O2 t9 s+ N: }
( \1 p' G* f+ ~0 j
 楼主| 发表于 2017-1-31 15:44 | 显示全部楼层
   1 import wx
! l, g( ?& X! j' `4 ^   2
- j4 D9 z2 ]' N; z5 h. K   3 class MainWindow(wx.Frame):
. c+ U1 c8 M1 p8 ?7 F/ M9 n   4     def __init__(self, parent, title):% L  N; _! Q8 X. d- ?3 @0 O
   5         wx.Frame.__init__(self, parent, title=title, size=(200,100))
& ?9 N( a" b) c; I   6         self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
) H, n& I7 f" X   7         self.CreateStatusBar() # A Statusbar in the bottom of the window  B8 x7 k2 J# f1 Q0 X% z2 Z# i
   8
! E7 j- z6 T0 h' x) L1 B# K   9         # Setting up the menu.
* E) W* Q9 m( S3 B  10         filemenu= wx.Menu()
$ q2 U# {* o. B1 b& [  11 4 W, y3 [/ A/ W
  12         # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.
( W# n% v* U  {  M; k  13         filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")0 Y* ~+ v( x7 M% U# Z
  14         filemenu.AppendSeparator()
1 F, P! [) r3 Y) E- ~2 A; o  15         filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")
: c' u6 q/ k1 w1 U+ P+ S, m  16
0 X( C, {- F7 a  17         # Creating the menubar.! V0 M5 J( U9 G: M' `# S* k
  18         menuBar = wx.MenuBar()( q% h9 u7 V/ x0 G: |9 _5 ~" F; ?
  19         menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar
1 k/ r* T+ j; N: p9 p4 z  20         self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.8 ?6 {$ w! q% y$ x) g6 k
  21         self.Show(True)
+ [- R. |/ f1 R. R4 B2 a  22 " B  K) @* S5 b) g9 Y: F. q+ l
  23 app = wx.App(False)
  a8 o  ?; z/ N* x3 J- V  24 frame = MainWindow(None, "Sample editor")2 [3 i; I- U  {6 w  M4 S3 Y
  25 app.MainLoop()
 楼主| 发表于 2017-1-31 15:46 | 显示全部楼层
运行效果0 W, h9 {+ I- I1 v9 M, s1 V
hello.png 1 j0 Z( q+ m9 K( R
 楼主| 发表于 2017-1-31 15:47 | 显示全部楼层
小小TESTED 如果有DX 请多多指教
发表于 2017-2-1 08:42 | 显示全部楼层
没看明白,能否稍加解释?
! r7 _4 M* {2 [# o: W% k谢谢!
 楼主| 发表于 2017-2-1 11:48 | 显示全部楼层
yanjian 发表于 2017-2-1 08:42# S' Z1 \, C! F+ X4 Z
没看明白,能否稍加解释?8 s3 Y8 R2 u8 i% A) n- D
谢谢!

( U1 I6 d1 s8 B. O3 j其实没什么东西来的,只不过是一些安装这个软件的步骤,这个没必要看明啊,了解就行。
% p% a! z" n" c' }, W3 Y1 |

本版积分规则

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

GMT+8, 2025-4-28 04:34 , Processed in 0.050967 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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