一乐电子

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

QQ登录

只需一步,快速开始

微信扫码登录

手机号码,快捷登录

手机号码,快捷登录

搜索
查看: 2264|回复: 5

linux安装wxpython

[复制链接]
发表于 2017-1-31 15:43 | 显示全部楼层 |阅读模式
curl http://apt.wxwidgets.org/key.asc | sudo apt-key add - sudo apt-get update : X6 D) E% w3 X, A. R
sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n
% P5 g6 t3 z1 u
/ Q% p  C* ~. Osudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n libwxgtk2.8-dev libgtk2.0-dev% k1 p9 l9 h/ l

" k, o* \3 Q4 R8 V' F, i
 楼主| 发表于 2017-1-31 15:44 | 显示全部楼层
   1 import wx
8 I2 }2 F+ I( F* V   2 * n# o8 {" y& [8 x* W
   3 class MainWindow(wx.Frame):
. a! E* g5 w0 x" ^, Q2 p% q   4     def __init__(self, parent, title):* G& L8 K6 s* D9 u" A* h0 M  d
   5         wx.Frame.__init__(self, parent, title=title, size=(200,100))
1 J8 K6 }" u' _9 q  _- }   6         self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
9 i  M, G6 A$ B; J: i# ]) x   7         self.CreateStatusBar() # A Statusbar in the bottom of the window
- |- Z! ^5 Q/ W   8 $ K2 [+ k/ O2 d; i3 Q0 m. i9 D6 D5 W
   9         # Setting up the menu." U/ M/ e! u8 W6 {  H" I
  10         filemenu= wx.Menu()0 d  T9 P4 _3 y. ^2 }0 _3 X9 P
  11 ' k! [' ~. C# y# C0 M+ g
  12         # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.0 m; {9 H9 L) F3 M: A& E$ s
  13         filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")# T# L' w, \- ~1 l# r
  14         filemenu.AppendSeparator()
8 t' L0 Q! H# L) e7 G3 c2 W  15         filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")
! Y$ g2 f$ {" B/ l  16
: L/ s* h! j! C" G: G  17         # Creating the menubar.
$ u9 ~# F2 _  e; t  18         menuBar = wx.MenuBar()
, \3 C7 R" y4 p$ J  m/ ]2 q  19         menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar# n. |4 P2 |2 u
  20         self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.
6 [' b3 t$ B$ y6 h' S* w  21         self.Show(True)1 c) p6 {+ L; Y5 N2 [6 r- S$ J3 e3 X
  22 4 `, G/ m6 _/ v& ^. g# g  t
  23 app = wx.App(False)2 t0 G7 n8 M9 R
  24 frame = MainWindow(None, "Sample editor")& t4 Z5 D# P/ _6 |" Q, {! N
  25 app.MainLoop()
回复

使用道具 举报

 楼主| 发表于 2017-1-31 15:46 | 显示全部楼层
运行效果
1 i4 E. d$ ]5 r% t5 X hello.png
& e) `) A: X( v7 \$ ^
回复

使用道具 举报

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

使用道具 举报

发表于 2017-2-1 08:42 | 显示全部楼层
没看明白,能否稍加解释?
4 p3 ^/ |+ m7 H  R2 Q1 M9 `& t- _谢谢!
回复

使用道具 举报

 楼主| 发表于 2017-2-1 11:48 | 显示全部楼层
yanjian 发表于 2017-2-1 08:427 e9 U, k. e, {% Z  D, v  d6 z1 Z
没看明白,能否稍加解释?
) k; @  a% M9 \' V$ ?谢谢!

. Q% ]9 r' {4 W- w4 A其实没什么东西来的,只不过是一些安装这个软件的步骤,这个没必要看明啊,了解就行。7 h8 p" ]/ ~- P- `
回复

使用道具 举报

本版积分规则

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

GMT+8, 2025-10-28 06:17 , Processed in 0.033604 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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