[wxPython-users] wxMenuItem.IsChecked

Robin Dunn robin at alldunn.com
Thu Aug 2 13:02:24 PDT 2007


David Montgomery wrote:
> Hi,
> 
> In my handler for a wx.ITEM_CHECK menu item,
> I'm looking up the menu item and calling item.IsChecked.
> My intent was to use the returned value as an indication
> of whether the checked item was just turned on, or just
> turned off.
> 
> What I see, however, is that item.IsChecked is always
> returning False.
> 
> (The menu item itself does toggle between showing and not
> showing a check.)
> 
> Is this expected behavior?  Is there some other recommended
> way to get whether the item is becoming checked or
> unchecked?

Try menuBar.IsChecked(menuItem.GetId())

The menu items are not kept up to date with the state of the menu, but 
are more for use of creating menus or for a holding place when fetching 
the current state of an item from a menu.

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





More information about the wxpython-users mailing list