版主
主题
帖子
积分10609
阅读权限200
注册时间2008-11-22
最后登录1970-1-1
在线时间 小时
|
楼主 |
发表于 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() |
|