版主
  
主题
帖子
积分10609
阅读权限200
注册时间2008-11-22
最后登录1970-1-1
在线时间 小时
|

楼主 |
发表于 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() |
|