checkedItems = [i for i in range(citList.GetCount()) if citList.IsChecked(i)]
citList.GetChecked()
should have also completed the task for you. May the problem be that you are trying to get selected items in __init__
?
Upd.: You do not want to get checked items during __init__
- they cannot be checked by the user at that moment. You'd better check them in any event handler, e.g. wx.EVT_BUTTON
.
Try writing self
more often, e.g.:
self.citList = wx.CheckListBox(self, -1, (60, 50), wx.DefaultSize, allLoc)
# some code
self.panel = citPanel(self, -1)
and change Clicked
to:
def Clicked(self, event):
checkedItems = [i for i in range(self.panel.citList.GetCount()) if self.panel.citList.IsChecked(i)]
print checkedItems
event.Skip()
Hope this helps.
Li0liQ
2010-01-04 19:51:40