from manygui import Application, Window, MenuBar, Menu, MenuCheck, Label, link, TextField from manygui.LayoutManagers import SimpleGridManager app = Application() win = Window(title='Menu Example', geometry=(50,50,100,100)) win.layout = SimpleGridManager(1,2) # A menubar for the window. mbar = MenuBar() win.addMenu(mbar) # A menu to choose skits. skitMenu = Menu(text="Skit") mbar.add(skitMenu) # Populate the skit menu. lbl = Label(text="No skit selected") win.add(lbl) def chooseSkit(ev): # Handle a skit choice. A menu event should have a # 'text' property containing the text of the menu item. lbl.text = ev.text # The objects returned by the add...() calls are handles that permit # us to operate on the menu items later. dedPrt = skitMenu.addCommand(text="Dead Parrot") pengTv = skitMenu.addCommand(text="Penguin on the Telly") link(dedPrt,chooseSkit) link(pengTv,chooseSkit)