[wxPython-users] Is CheckListBox.GetSelections() supposed to work as in ListBox.GetSelections()?

Robin Dunn robin at alldunn.com
Tue Aug 15 23:43:31 PDT 2006


Pierre Rouleau wrote:
> Hi all,
> 
> I am using a CheckListBox and trying to call GetSelections() to get a 
> tuple of all currently checked items.  However, the method always only 
> returns a tuple of 1 item: the first one that is checked.  The test code 
> does not run in the handler of the CheckListBox, it runs in some other 
> method when the CheckListBox is in a stable state.


GetSelections is exactly the same as in the wx.ListBox, it returns the 
items that are selected.  That is different than the items that are 
checked.  To get the items that are checked you'll need to do something 
like this:

	items = [i for i in range(lb.GetCount()) if lb.IsChecked(i)]

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





More information about the wxpython-users mailing list