wxPython学习2005-07-21

博客涉及WxPython相关内容,包含menu、file等元素,还提及class、import等编程概念,但具体内容未给出。
60  # Start of file
14 from wxPython.wx import *
15
16 ID_ABOUT = 101

17 ID_EXIT = 102
18
19 class MyFrame(wxFrame):
20 def __init__(self, parent, ID, title):
21 wxFrame.__init__(self, parent, ID, title, wxDefaultPosition, wxSize(200, 150))
22 self.CreateStatusBar()

23 self.SetStatusText("This is the statusbar")
24
25 menu = wxMenu()
26 menu.Append(ID_ABOUT, "&About","More information about this program")

27 menu.AppendSeparator()
28 menu.Append(ID_EXIT, "E&xit", "Terminate the program")
29
30 menuBar = wxMenuBar()
31 menuBar.Append(menu, "&File");

32
33 self.SetMenuBar(menuBar)
34
35 EVT_MENU(self, ID_ABOUT, self.OnAbout)
36 EVT_MENU(self, ID_EXIT, self.TimeToQuit)
37
38 def OnAbout(self, event):

39 dlg = wxMessageDialog(self, "This sample program shows off/n"
40 "frames, menus, statusbars, and this/n"
41 "message dialog.",
42 "About Me", wxOK | wxICON_INFORMATION)

43 dlg.ShowModal()
44 dlg.Destroy()
45
46 def TimeToQuit(self, event):
47 self.Close(True)
48
49 class App(wxApp):

50 def OnInit(self):
51 frame = MyFrame(NULL, -1, "Hello from wxPython")
52 frame.Show(True)
53 self.SetTopWindow(frame)
54 return True

55
56 if __name__ == "__main__":
57 app = App(0)
58 app.MainLoop()
59
60 # end of file

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值