|
From: Kevin A. <al...@se...> - 2001-09-04 23:34:18
|
I changed the method names to
getChecked
setChecked
getEnabled
setEnabled
getChecked and getEnabled return -1 if the MenuItem can't be found
>>> bg.menuBar.getEnabled('bogus')
-1
You can enable or disable a whole menu like so (example using proof.py):
>>> bg.menuBar.setEnabled('mnuFile', 0)
Due to a missing feature in wxPython, finding out whether a whole menu is
enabled or disabled will have to wait until 2.3.2 is released unless I find
that I missed a method in the docs.
BTW, the methods above obviously aren't dot notation. You would need to do
something like:
>>> bg.menubar.mnuFile.mnuExit.enabled = 1
which menu.py doesn't currently support. Since menu.py needs to be
completely rewritten at some point, we'll probably wait until the rewrite to
do dot notation. The existing module won't accomodate it very easily.
ka
> -----Original Message-----
> From: pyt...@li...
> [mailto:pyt...@li...]On Behalf Of Kevin
> Altis
> Sent: Tuesday, September 04, 2001 3:31 PM
> To: pythoncard-Users
> Subject: [Pythoncard-users] enable and check menu items
>
>
> 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
>
>
> _______________________________________________
> Pythoncard-users mailing list
> Pyt...@li...
> https://lists.sourceforge.net/lists/listinfo/pythoncard-users
>
|