版主
主题
回帖0
积分10609
阅读权限200
注册时间2008-11-22
最后登录1970-1-1
在线时间 小时
|
楼主 |
发表于 2017-1-31 15:44
|
显示全部楼层
1 import wx; b- \( K) h# M! A7 N+ v
2
2 e4 V/ D+ }+ M0 L" Q 3 class MainWindow(wx.Frame):- W4 X. h( \3 b2 M6 y& n, Z, [
4 def __init__(self, parent, title):9 h1 z9 b2 r: C0 y6 O) q8 C
5 wx.Frame.__init__(self, parent, title=title, size=(200,100))& @8 U3 D- a% Y5 ]
6 self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
1 g3 a+ z. U( h0 ]# _ 7 self.CreateStatusBar() # A Statusbar in the bottom of the window% Y! ^! X( z3 u: I* A8 t6 }5 @
8
& M9 e: u- u7 d/ }9 x 9 # Setting up the menu.: y$ f# @; [* I6 G; V$ y
10 filemenu= wx.Menu()$ C) M: _& |3 ?7 m8 R! O6 [) t1 H
11 . i7 ]& I: h1 B$ P0 ?1 R) z* l
12 # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.1 _' b( _5 c- D+ y
13 filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")6 u3 H0 ^+ o/ D* z ?
14 filemenu.AppendSeparator()
0 O) S: P6 \+ @; g4 |) j' U 15 filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")+ P$ B0 E& [5 R/ v
16
( P2 m C7 Y3 r: X 17 # Creating the menubar.
: Q+ p3 F1 W% u' B 18 menuBar = wx.MenuBar()+ F3 l0 \2 X' ?/ E7 X2 o9 @* {% u
19 menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar# G; v$ F# O! C+ t1 n
20 self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content.
, e: ]* Q8 m0 |% x$ R/ \- e 21 self.Show(True)- C* a$ Z& B1 {- Q3 {* h
22
! N' V3 M! E2 h' l 23 app = wx.App(False)
8 B( \9 G( d8 O, r; z 24 frame = MainWindow(None, "Sample editor")
3 t3 Q+ X7 A' w1 \8 y0 \( I 25 app.MainLoop() |
|