版主
主题
回帖0
积分10609
阅读权限200
注册时间2008-11-22
最后登录1970-1-1
在线时间 小时
|
楼主 |
发表于 2017-1-31 15:44
|
显示全部楼层
1 import wx
; g7 d" @6 F' i9 ^ 2 * Q! @" U0 d1 l, y4 C
3 class MainWindow(wx.Frame):
; J/ R- n8 {# Z: n4 Q: @* u# A3 D' _ 4 def __init__(self, parent, title):- F; O& M, m& R' \. s1 J1 G# R
5 wx.Frame.__init__(self, parent, title=title, size=(200,100))
% Z& }; g* Q! h ? Z( k 6 self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)0 Q4 {- K& }$ V1 g
7 self.CreateStatusBar() # A Statusbar in the bottom of the window: G; p' u' } _; q( v
8 # q9 {! d _. V6 M1 U# J1 |
9 # Setting up the menu.$ T: L( g) a$ ]/ m; ]$ C
10 filemenu= wx.Menu()2 P5 N+ k; j1 a w8 s
11
+ I- Q! G) E2 r3 e 12 # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets., D) J+ @2 Z4 x2 x3 o4 M2 k% p- w
13 filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program")
6 b: D% [) C3 j5 \5 r! L; S4 D 14 filemenu.AppendSeparator()
% E/ W% S* @( t' l 15 filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")2 N9 I6 | |" m
16
0 \) ^. B& f; e! F9 I 17 # Creating the menubar.% r8 c# j( s* _, i3 e
18 menuBar = wx.MenuBar()$ I% r4 ]4 {- B' b
19 menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar2 }+ p1 s: Z9 t3 p* I, W9 h
20 self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content.
6 C9 o. j M, \* u! k2 l 21 self.Show(True)
8 z6 O6 w8 u1 j6 W6 r5 I 22
9 z7 h% U$ ~5 _1 ] 23 app = wx.App(False)
7 c5 y+ Q+ i- ^+ E 24 frame = MainWindow(None, "Sample editor")
* R# O* H( ^3 {% H- T; | 25 app.MainLoop() |
|