版主
主题
回帖0
积分10609
阅读权限200
注册时间2008-11-22
最后登录1970-1-1
在线时间 小时
|
楼主 |
发表于 2017-1-31 15:44
|
显示全部楼层
1 import wx
* ` Q* y5 K/ f+ B2 x! ~+ y 2
3 t1 E) n0 [! u* r: d/ ]7 [3 F; Q5 j' V 3 class MainWindow(wx.Frame):1 _0 O% l7 s T0 L
4 def __init__(self, parent, title):
- O' [( o% G- n1 y" T; `2 Q: V 5 wx.Frame.__init__(self, parent, title=title, size=(200,100))" t2 @, |1 [$ }, I7 b& _
6 self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)2 J5 b# Z: T7 v4 e( C* i9 D
7 self.CreateStatusBar() # A Statusbar in the bottom of the window
! g1 t! q+ _. W s. G. k 8 / x$ E7 N: J' g* h c
9 # Setting up the menu.; L2 j: e& S+ m
10 filemenu= wx.Menu() A# ?% [6 y8 F1 L
11
, {/ [3 p+ Y7 p4 }4 S 12 # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.
. b9 G' ]. s9 R% }+ q 13 filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
L& m/ K+ m: i& Q1 u1 n. Y; g1 p* O 14 filemenu.AppendSeparator()
* ]3 P8 O% F: B6 \ 15 filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")
* C7 t0 S- h4 l" A6 \9 x8 H/ \9 F o 16
5 a& ~% L5 L- C& K% m6 n e 17 # Creating the menubar., b, j: L x. {- ?+ l/ B4 E% ^
18 menuBar = wx.MenuBar()
/ [) b' D" B: U7 ~; k 19 menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar
3 w! x# A& T8 G+ W# y9 b 20 self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content.8 w( v* y1 H& i0 U7 U
21 self.Show(True)" Z8 B M5 z. E
22 ' k: R! b5 f) i6 S0 |* c! M
23 app = wx.App(False)& M- k/ |: h# C- C
24 frame = MainWindow(None, "Sample editor")$ K0 R2 ~$ L" Z4 i3 x: R
25 app.MainLoop() |
|