From: Kevin A. <al...@se...> - 2001-09-04 22:30:03
|
I updated menu.py in cvs, so you can now enable/disable and check/uncheck menu items. You pass in the 'name' of the MenuItem object as defined in the .rsrc.py file for the application. For example, if you run proof.py with the shell, you can disable the File -> Exit menu item with: >>> bg.menuBar.enable('mnuExit', 0) and then enable it with: >>> bg.menuBar.enable('mnuExit') you can check a menu item the same way. You can't disable/enable a whole menu right now, because the method I wanted to use apparently isn't in wxPython 2.3.1 even though it is in the docs. If I figure out another way to do it, I'll make the change. I updated the addresses sample to use this method rather that relying on wxPython method calls directly. #menubar = self.GetMenuBar() #id = menubar.FindMenuItem('File', 'Import Outlook') #menubar.Enable(id, 0) self.menuBar.enable('menuFileImportOutlook', 0) ka |