如何从 wxpython ListBox 获取项目列表 [英] How to get item list from wxpython ListBox

查看:23
本文介绍了如何从 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆