An example of a menu (WXPython)

xiaoxiao2021-03-06  14

From wxpython.wx import *

# Define message number ID_about = 101 id_about = 101 id_exit = 102 Class MyFrame (wxframe): DEF __INIT, ID, TITLE:

# Parameter sequence: wxframe .__ init __ (self, parent, id, title, wxdefaultposition, wxsize (200, 150)) Self.createStatusbar () # Create Status Bar Self.SetStatustext ("this is the statusbar") # Set status bar information Menu = wxmenu () # Create a menu item menu.Append (id_about, "& quara") # Add menu item menu.AppendSeparator () # 分 分 m m.Append (id_exit, "e & xit", " Terminate The Program ") # Increases EXIT item. MenuBar = wxmenubar () # Create a menu bar menubar.Append (Menu," & File "); # Create top Menu Self.setmenubar (MenuBar) Class MyApp (wxapp): Def Oninit (Self" : Frame = myframe (null, -1, "hello from wxpython) frame.show (true) self.SettopWindow (frame) Return True App = myApp (0) app.mainloop ()

转载请注明原文地址:https://www.9cbs.com/read-50284.html

New Post(0)