1
感谢S.洛特的及时回复。使用组合框值
我的问题是关于这个链接我的第一篇:这样
Python GTK adding signal to a combo box
我想重用在主窗口界面
组合的变化值是否有可能,以及怎么样 ?
感谢一些解释
问候
感谢S.洛特的及时回复。使用组合框值
我的问题是关于这个链接我的第一篇:这样
Python GTK adding signal to a combo box
我想重用在主窗口界面
组合的变化值是否有可能,以及怎么样 ?
感谢一些解释
问候
如果您使用的是有自己的自定义模型组合框,你可以随时获取所选项目的数据:
index = combo.get_active()
model = combo.get_model()
item = model[index]
print item[0] ## , item[1], ...
但如果你是使用文本组合框(使用gtk.combo_box_new_text()
创建),更易于使用:
item_text = combo.get_active_text()
print item_text
我不明白你的问题!如果你想获得组合框中活动项目的索引?然后使用'combo.get_active()'。如果你想获得所选项目的数据(例如:文本),你可以从'combo.get_active()'得到索引,'combo.get_model()'得到模型,那么问题是什么? 'item = combo.get_model()[combo.get_active()]' – saeedgnu 2011-04-09 07:33:17