一乐电子

一乐电子百科

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

QQ登录

只需一步,快速开始

快捷登录

手机号码,快捷登录

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

linux安装wxpython

[复制链接]
发表于 2017-1-31 15:43 | 显示全部楼层 |阅读模式
curl http://apt.wxwidgets.org/key.asc | sudo apt-key add - sudo apt-get update * F: o1 }, `& M; \. g  E+ b9 u
sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n& e/ A" ~' d* z5 i. R
, z& W% K2 y& X- M4 K" D
sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n libwxgtk2.8-dev libgtk2.0-dev# a2 L0 p+ g  D, F/ a1 a+ `: B

& H" E& ~, W* P8 s$ l
 楼主| 发表于 2017-1-31 15:44 | 显示全部楼层
   1 import wx) q0 }6 T6 g4 U* \- `" {$ ~& l5 n
   2 $ j: {" O3 L4 k& Z8 _
   3 class MainWindow(wx.Frame):( u0 r! Z; V9 s( l% G3 e
   4     def __init__(self, parent, title):; R3 I1 s9 z$ i: B
   5         wx.Frame.__init__(self, parent, title=title, size=(200,100)), P# x2 @& ~; F5 Z8 ~1 I6 [
   6         self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)9 N& D2 [8 d) c& f
   7         self.CreateStatusBar() # A Statusbar in the bottom of the window
! j/ i* X! v5 m! [/ T' G   8
8 K7 s& J0 m6 T6 y" {   9         # Setting up the menu.& Z* Y9 N; }# R) r. I
  10         filemenu= wx.Menu()* ^1 C. H/ \, ^& t4 q: C# h& ~8 O7 t/ ]
  11 4 G$ c; @5 d6 Q1 T6 x8 g$ A
  12         # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.
8 `' `: {, [# Z! J( v  13         filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
. _2 s8 K& w3 x2 D  14         filemenu.AppendSeparator()
4 ?- _0 V; ?" ^2 i  15         filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")* r$ G& ^. Q5 [& A+ B2 O
  16
1 T5 n/ D( n) U  P6 M# d* d! E  17         # Creating the menubar.
. T' f; ?9 K4 D3 F7 x4 Y/ @  18         menuBar = wx.MenuBar()* d  k2 q0 g' V3 T8 E- u, D% J: |0 z
  19         menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar
7 G- d6 ^8 E; Y1 G; E  20         self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.4 x4 D- U, S' w$ N2 a/ L
  21         self.Show(True)
7 n/ A9 p- N7 R* b& _  22 & A9 [; R6 M0 u* m; g) Y
  23 app = wx.App(False)9 }# w- j8 k; j1 c; ]5 a3 C
  24 frame = MainWindow(None, "Sample editor")( Y. I4 l3 ?' |) I
  25 app.MainLoop()
 楼主| 发表于 2017-1-31 15:46 | 显示全部楼层
运行效果6 Y* o0 m+ O/ b, I
hello.png
' U3 J" n, F' q3 F# T8 \4 S- H
 楼主| 发表于 2017-1-31 15:47 | 显示全部楼层
小小TESTED 如果有DX 请多多指教
发表于 2017-2-1 08:42 | 显示全部楼层
没看明白,能否稍加解释?
) W2 q" W. h% q/ y9 B8 z谢谢!
 楼主| 发表于 2017-2-1 11:48 | 显示全部楼层
yanjian 发表于 2017-2-1 08:42
: [, w5 t$ S. C4 i# _6 r! ]没看明白,能否稍加解释?) `: n* Z: a- w# P8 m' w* i1 g
谢谢!

  V+ Y+ T$ s/ B其实没什么东西来的,只不过是一些安装这个软件的步骤,这个没必要看明啊,了解就行。! |1 @) y$ s: S3 }; Q

本版积分规则

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

GMT+8, 2024-4-27 09:01 , Processed in 0.049848 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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