Wesley Phillips wrote:
>I am trying to enable a menu item from another menu item. I originally set a menu item enable to false and it shows up greyed out, which is good. When a user performs another menu action, the greyed out menu item is enabled. I get the following errors:
>
> File "C:\Python24\lib\site-packages\PythonCard\menu.py", line 204, in _dispatch
> handler(background, aWxEvent)
> File "C:\Documents and Settings\ko22931\workspace\PCard Test\ASAmp3\ASAmp3.py", line 175, in on_main_menuSelect_Directory_select
> self.components.main_menuAdd_Info.enabled=True
> File "C:\Python24\lib\site-packages\PythonCard\model.py", line 77, in __getattr__
> return self.data[key]
>KeyError: 'main_menuAdd_Info'
>
>Any ideas why this will not work?
>
>
>
Menu items are not components, so you can't enable / disable them this way.
You do this by
self.menuBar.setEnabled('main_menuAdd_Info', True)
assuming 'menuCommandsAutoRefresh' is the name of the menu item.
You can also do getEnabled, or getChecked/setChecked, etc.
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.1/389 - Release Date: 14/07/2006
|