版主
主题
回帖0
积分10609
阅读权限200
注册时间2008-11-22
最后登录1970-1-1
在线时间 小时
|
楼主 |
发表于 2017-1-31 15:44
|
显示全部楼层
1 import wx
: n9 j8 @& f$ W' |/ R/ M/ S 2 ' o6 p2 Z1 W. _% y8 D) d3 ?
3 class MainWindow(wx.Frame):* l( `6 i' M3 h! T
4 def __init__(self, parent, title):$ ^$ c6 s2 d" v2 _: Z0 {! W
5 wx.Frame.__init__(self, parent, title=title, size=(200,100))
2 s, Z0 X8 s. d) | 6 self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
, b7 m7 u1 ^1 y& B7 u0 `: a# \ 7 self.CreateStatusBar() # A Statusbar in the bottom of the window4 c8 c4 K2 t9 G4 \: a, Z
8
. X5 ~( Q( {, P" r 9 # Setting up the menu.
) p3 {6 D7 a$ [; E( U9 b 10 filemenu= wx.Menu()+ g* Z3 S' T+ M" t0 N
11 1 |; k0 L4 g0 L9 \! `; ]3 i
12 # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets.5 F m/ k) t' w
13 filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
. o5 I. y# o) X0 D 14 filemenu.AppendSeparator() ~& M- v t$ E, S$ N+ m0 o
15 filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")
* c7 h, m0 E: V4 a3 u 16
! @+ w7 H6 ?' _& b 17 # Creating the menubar., B: D! \2 }, w1 u5 T8 `7 i" E
18 menuBar = wx.MenuBar()
2 D" ~1 y# R) y' z- X) ? 19 menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar1 B3 N/ Y/ q! d" s- k
20 self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content.2 u) ~9 v4 V$ b" S# F( u* ]9 M
21 self.Show(True)
6 N2 E5 f& u9 i* h- s9 b/ O6 Y 22
8 v" y4 ?& }2 M, t2 F6 V 23 app = wx.App(False)7 Z V! e, O' M# ?* r4 s' F @
24 frame = MainWindow(None, "Sample editor")" z/ b* B( L. q3 }, S/ C- p- ]
25 app.MainLoop() |
|