创建菜单和状态栏控件

来源:互联网 发布:淘宝电热护肩定制 编辑:程序博客网 时间:2024/05/20 23:04

运行效果图:


Python代码:

#!/usr/bin/env python# -*- encoding:utf-8 -*-'Create Menu Example'import wxclass MyFrame(wx.Frame):    def __init__(self,parent,id):        wx.Frame.__init__(self,parent,id,'Create Menu',size=(300,200))        panel=wx.Panel(self)        status=self.CreateStatusBar()#创建状态栏        menubar=wx.MenuBar()#创建菜单栏        first=wx.Menu()#创建菜单        second=wx.Menu()        first.Append(wx.NewId(),'New Window','This is a new window')#增加菜单项        first.Append(wx.NewId(),'Open...','This will open a new window')        menubar.Append(first,'File')#把菜单项加入到file菜单        menubar.Append(second,'Edit')#edit菜单        self.SetMenuBar(menubar)if __name__=='__main__':    app=wx.PySimpleApp()    myframe=MyFrame(parent=None,id=-1)    myframe.Show(True)    app.MainLoop()


原创粉丝点击