简体   繁体   中英

How to get item list from wxpython ListBox

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()

eg

listBoxList = yourListBox.GetStrings()

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

您可以在列表框中获取字符串列表,如:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM