一乐电子

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

QQ登录

只需一步,快速开始

微信扫码登录

手机号码,快捷登录

手机号码,快捷登录

搜索
查看: 2266|回复: 5

linux安装wxpython

[复制链接]
发表于 2017-1-31 15:43 | 显示全部楼层 |阅读模式
curl http://apt.wxwidgets.org/key.asc | sudo apt-key add - sudo apt-get update
9 d( C. K- g5 h  f$ L- { sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n% D1 K4 R3 L% @2 Y1 @* s3 o
# K+ }% V" Q- L) i
sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n libwxgtk2.8-dev libgtk2.0-dev
& _' G' M5 A4 o+ [$ x5 l9 T1 S" }' Y7 x
 楼主| 发表于 2017-1-31 15:44 | 显示全部楼层
   1 import wx
; g7 d" @6 F' i9 ^   2 * Q! @" U0 d1 l, y4 C
   3 class MainWindow(wx.Frame):
; J/ R- n8 {# Z: n4 Q: @* u# A3 D' _   4     def __init__(self, parent, title):- F; O& M, m& R' \. s1 J1 G# R
   5         wx.Frame.__init__(self, parent, title=title, size=(200,100))
% Z& }; g* Q! h  ?  Z( k   6         self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)0 Q4 {- K& }$ V1 g
   7         self.CreateStatusBar() # A Statusbar in the bottom of the window: G; p' u' }  _; q( v
   8 # q9 {! d  _. V6 M1 U# J1 |
   9         # Setting up the menu.$ T: L( g) a$ ]/ m; ]$ C
  10         filemenu= wx.Menu()2 P5 N+ k; j1 a  w8 s
  11
+ I- Q! G) E2 r3 e  12         # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets., D) J+ @2 Z4 x2 x3 o4 M2 k% p- w
  13         filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
6 b: D% [) C3 j5 \5 r! L; S4 D  14         filemenu.AppendSeparator()
% E/ W% S* @( t' l  15         filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")2 N9 I6 |  |" m
  16
0 \) ^. B& f; e! F9 I  17         # Creating the menubar.% r8 c# j( s* _, i3 e
  18         menuBar = wx.MenuBar()$ I% r4 ]4 {- B' b
  19         menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar2 }+ p1 s: Z9 t3 p* I, W9 h
  20         self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.
6 C9 o. j  M, \* u! k2 l  21         self.Show(True)
8 z6 O6 w8 u1 j6 W6 r5 I  22
9 z7 h% U$ ~5 _1 ]  23 app = wx.App(False)
7 c5 y+ Q+ i- ^+ E  24 frame = MainWindow(None, "Sample editor")
* R# O* H( ^3 {% H- T; |  25 app.MainLoop()
回复

使用道具 举报

 楼主| 发表于 2017-1-31 15:46 | 显示全部楼层
运行效果
; d+ d& i9 c/ x  A3 ? hello.png ' L  u- h7 ^! a6 v8 L. c7 a# M& B
回复

使用道具 举报

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

使用道具 举报

发表于 2017-2-1 08:42 | 显示全部楼层
没看明白,能否稍加解释?
0 B, e# n* O% Z6 O$ d谢谢!
回复

使用道具 举报

 楼主| 发表于 2017-2-1 11:48 | 显示全部楼层
yanjian 发表于 2017-2-1 08:42' {: z  ?" e1 l7 R: i$ j
没看明白,能否稍加解释?0 j. \1 u3 D$ J. H9 T1 Z% K
谢谢!

* ^2 Q3 l6 ]- G, |0 F9 P4 L+ S其实没什么东西来的,只不过是一些安装这个软件的步骤,这个没必要看明啊,了解就行。" w  r" b4 `5 n+ _" }; {
回复

使用道具 举报

本版积分规则

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

GMT+8, 2025-10-29 20:46 , Processed in 0.035864 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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