3.添加菜单
来源:互联网 发布:飞飞cms影视系统3.0 编辑:程序博客网 时间:2024/06/05 18:32
每个应用程序都应该有一个菜单栏和一个状态栏。让我们将它们添加到我们的:
self.CreateStatusBar() filemenu = wx.Menu() filemenu.Append(wx.ID_ABOUT,"&About","Infomation about this program") filemenu.AppendSeparator() filemenu.Append(wx.ID_EXIT,"E&xit","Close program") menuBar = wx.MenuBar() menuBar.Append(filemenu,"&File") self.SetMenuBar(menuBar)
注意:wx.ID_ABOUT,wx.ID_EXIT都是wxPython的标准组合ID,这是一个好习惯使用标准的ID
完整的程序:
'''Created on 2012-6-28@author: Administrator'''import wxclass MyFrame(wx.Frame): def __init__(self,parent,title): wx.Frame.__init__(self,parent,title=title,size=(400,300)) self.control = wx.TextCtrl(self,style=wx.TE_MULTILINE) self.CreateStatusBar() filemenu = wx.Menu() filemenu.Append(wx.ID_ABOUT,"&About","Infomation about this program") filemenu.AppendSeparator() filemenu.Append(wx.ID_EXIT,"E&xit","Close program") menuBar = wx.MenuBar() menuBar.Append(filemenu,"&File") self.SetMenuBar(menuBar) self.Show(True)app = wx.App(False)frame = MyFrame(None,"Small Editor")app.MainLoop()
运行程序应该如下画面:
- 3.添加菜单
- 3.添加菜单
- 添加菜单
- 添加菜单
- 添加菜单
- 动态添加菜单\删除菜单\插入菜单
- 给菜单添加快捷键
- 动态添加菜单
- Delphi动态添加菜单
- Explorer文件菜单添加
- 动态添加菜单
- 手动添加菜单
- MTK6226 添加菜单实例
- 添加右键菜单
- windchill9.0 添加菜单
- 动态添加菜单
- 添加菜单按钮
- 怎样添加右键菜单?
- Android JNI_OnLoad()函数
- 关于 tslib-1.4配置Tiny6410触摸屏
- Busybox是什么?
- substring完美截取HTML字符
- 《JAVA与模式》26天系列—第18天—观察者模式
- 3.添加菜单
- eclipse快捷鍵
- 六、java的流程控制
- CKEditor for ASP.NET(1)——系统需求
- web.xml 配置404和500错误的自定义页面
- BIEE建模技巧之-利用环状模型处理时间维与Type2缓慢变化维的联动
- CKEditor for ASP.NET(2)——控件集成指南
- Ubuntu下ibus-sunpinyin的安装及翻页快捷键设置
- Windows 7下VS2008升级补丁