# menus in wxPython 2.3.3
#
#-------------------------------------------------------------------
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
-# o Updated for wx namespace
-#
+# o Debug message when adding a menu item (see last menu):
+#
+# Debug: ..\..\src\msw\menuitem.cpp(370): 'GetMenuState' failed with
+# error 0x00000002 (the system cannot find the file specified.).
+#
import time
import wx
# Methods
def OnMenuHighlight(self, event):
- # Show how to get menu item imfo from this event handler
+ # Show how to get menu item info from this event handler
id = event.GetMenuId()
item = self.GetMenuBar().FindItemById(id)
- text = item.GetText()
- help = item.GetHelp()
+ if item:
+ text = item.GetText()
+ help = item.GetHelp()
- #print text, help
# but in this case just call Skip so the default is done
event.Skip()
overview = """\
-A demo of using wxMenuBar and wxMenu in various ways.
+A demo of using wx.MenuBar and wx.Menu in various ways.
A menu is a popup (or pull down) list of items, one of which may be selected
before the menu goes away (clicking elsewhere dismisses the menu). Menus may be
don't have any special properties while the check items have a boolean flag associated
to them and they show a checkmark in the menu when the flag is set. wxWindows
automatically toggles the flag value when the item is clicked and its value may
-be retrieved using either IsChecked method of wxMenu or wxMenuBar itself or by
+be retrieved using either IsChecked method of wx.Menu or wx.MenuBar itself or by
using wxEvent.IsChecked when you get the menu notification for the item in question.
The radio items are similar to the check items except that all the other items
if __name__ == '__main__':
import sys,os
import run
- run.main(['', os.path.basename(sys.argv[0])])
+ run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])