wxPython--基础组件-Menu菜单样例

 

#-*- coding:utf-8 -*-
import wx


class MainFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, "My Frame", size=(640, 360))
        menuBar = wx.MenuBar()
        menu = wx.Menu()

        menu.Append(-1, u'撤消(U)')
        menu.AppendSeparator()
        self.menu_select = menu.Append(-1, u'全选(N)\tCtrl+A') #快捷键
        self.Bind(wx.EVT_MENU, self.onSelect, self.menu_select)
        menuBar.Append(menu, u'编辑(F)')
        self.SetMenuBar(menuBar)

    def onSelect(self, event):
        print("onSelect")

def main():
    #设置了主窗口的初始大小960x540 800x450 640x360
    root = wx.App()
    frame = MainFrame()
    frame.Show(True)
    root.MainLoop()


if __name__ == "__main__":
    main()


http://blog.csdn.net/xxb2008

wxPython--基础组件-Menu菜单样例_第1张图片

 

你可能感兴趣的:(wxPython--基础组件-Menu菜单样例)