[wxPython-users] Re: How to check menu item state?

Robin Dunn robin at alldunn.com
Sat Feb 3 21:42:47 PST 2007


Basil Shubin wrote:
> Peter Decker wrote:
>> On 2/3/07, Basil Shubin <bashu at yandex.ru> wrote:
>>
>>> Just imagine a menubar with menu items, each menu item handler should
>>> check where this this item already checked or not. It's like IsChecked
>>> method for RADIO item, but this menu entries shouldn't be a RADIO-like.
>>
>> Are you defining the menu items with wx.ITEM_CHECK? Then you can just
>> check IsChecked()
> 
> No. And that is a problem, I want *plain* menu item without any 'kind' 
> properties. And don't know is it possible for menu item like that, to 
> check it state, to prevent from slecting twice.

When you get the first event for the menu item then disable it.  Then it 
can't be selected again.  If you don't want it to appear disabled, then 
you you just need to write your event handlers such that they ignore the 
other events.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list