如何从wxpython ListBox获取项目列表 [英] How to get item list from wxpython ListBox
问题描述
是否有单个方法返回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.
更新:
正如杰里米(Jeremy)指出的那样,使用GetStrings()
As pointed out by jeremy the way to do this is with GetStrings()
例如
listBoxList = yourListBox.GetStrings()
推荐答案
wx.ListBox
源自wx.ControlWithitems
.我认为 GetStrings()是您所需要的.
wx.ListBox
is derived from wx.ControlWithitems
. I think GetStrings() is what you need.
这篇关于如何从wxpython ListBox获取项目列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!