views:

55

answers:

2

Is there a single method that returns the list of items contained in a wxPython listBox?

I cant seem to find anything anywhere in the documentation or anywhere for that matter. All that I can think to do is to set the selection to all of the items and then get the selected items, though seems like an ugly roundabout way of doing something that should be simple.

Update:

As pointed out by jeremy the way to do this is with GetStrings()

e.g.

listBoxList = yourListBox.GetStrings()

+3  A: 

wx.ListBox is derived from wx.ControlWithitems. I think GetStrings() is what you need.

Jeremy Brown
@jeremy, +1, I just tried your vs my answer, and you are dead on.
Mark
+1 Exactly what I wanted -I new there had to be a simple way... Thanks
volting
+1  A: 

You can get a list of the strings in the listbox like:

[listBox.GetString(i) for i in range(listBox.GetCount())]
Mark