how to disable individual sub-menu elements?
I've got an app with a Pmw menubar. I can disable menu items, and enable them. For instance, to disable the first (0th) item in the Tools menu, I can write: self.menuBar.component('Tools-menu').entryconfig(0,state='disabled') Note that to access items in the Tools menu, I have to use the notation 'Tools-menu'. This is a sticking point, since it seems to indicate that I have to add '-menu' to a menu's name in order to access it. What would I do if the menu name had a space in it? So far, so good, however. But I don't see how to disable individual items under a cascaded sub-menu. For instance, under my Tools menu, I have a Build menu item with 2 cascaded sub-menu items. How would I disable the Build Initscript (0th) submenu? like the following? self.menuBar.component('Build-menu').entryconfig(0,state='disabled') (this doesn't work, BTW) And what if my menu name has a space in it? Here's the code that creates the submenus: self.menuBar.addcascademenu('Tools', 'Build', 'Build init script or linefill', traverseSpec = 'z', tearoff = 1, state = 'disabled', font = self.font) for viewer in ('Initscript', 'Linefill'): self.menuBar.addmenuitem('Build', 'command', 'Build ' + viewer, command = eval(toolsBldCmds[viewer]), font = self.font, label = 'Build ' + viewer) ''' toolsBldCmds = { 'Initscript': 'self.load', 'Linefill': 'self.edit_linefill'} ''' thx Stewart
participants (1)
-
stewart@midtoad.homelinux.org