版主
主题
回帖0
积分10609
阅读权限200
注册时间2008-11-22
最后登录1970-1-1
在线时间 小时
|
楼主 |
发表于 2017-1-31 15:44
|
显示全部楼层
1 import wx
8 I2 }2 F+ I( F* V 2 * n# o8 {" y& [8 x* W
3 class MainWindow(wx.Frame):
. a! E* g5 w0 x" ^, Q2 p% q 4 def __init__(self, parent, title):* G& L8 K6 s* D9 u" A* h0 M d
5 wx.Frame.__init__(self, parent, title=title, size=(200,100))
1 J8 K6 }" u' _9 q _- } 6 self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
9 i M, G6 A$ B; J: i# ]) x 7 self.CreateStatusBar() # A Statusbar in the bottom of the window
- |- Z! ^5 Q/ W 8 $ K2 [+ k/ O2 d; i3 Q0 m. i9 D6 D5 W
9 # Setting up the menu." U/ M/ e! u8 W6 { H" I
10 filemenu= wx.Menu()0 d T9 P4 _3 y. ^2 }0 _3 X9 P
11 ' k! [' ~. C# y# C0 M+ g
12 # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.0 m; {9 H9 L) F3 M: A& E$ s
13 filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")# T# L' w, \- ~1 l# r
14 filemenu.AppendSeparator()
8 t' L0 Q! H# L) e7 G3 c2 W 15 filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")
! Y$ g2 f$ {" B/ l 16
: L/ s* h! j! C" G: G 17 # Creating the menubar.
$ u9 ~# F2 _ e; t 18 menuBar = wx.MenuBar()
, \3 C7 R" y4 p$ J m/ ]2 q 19 menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar# n. |4 P2 |2 u
20 self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content.
6 [' b3 t$ B$ y6 h' S* w 21 self.Show(True)1 c) p6 {+ L; Y5 N2 [6 r- S$ J3 e3 X
22 4 `, G/ m6 _/ v& ^. g# g t
23 app = wx.App(False)2 t0 G7 n8 M9 R
24 frame = MainWindow(None, "Sample editor")& t4 Z5 D# P/ _6 |" Q, {! N
25 app.MainLoop() |
|