免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 7893 | 回复: 1
打印 上一主题 下一主题

请教wx.Choice设置默认选择值的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-03-22 23:09 |只看该作者 |倒序浏览
在使用wx.Choice时,想在初始化的时候设置一个默认的选择值,或者根据一些条件自动设定某一值。不知道wx.Choice是否可以实现,如果可以,应该怎么做?

谢谢了!

论坛徽章:
0
2 [报告]
发表于 2011-06-13 14:00 |只看该作者
wx的choice和ListBox很类似:

Choice control is used to select one of a list of strings. Unlike a wx.ListBox, only the selection is visible until the user pulls down the menu of choices.

我在ListBox里面找到了设置默认值的方法


SetSelection(self, n, select=True)

Sets the item at index 'n' to be the selected item.

Parameters:
n
           (type=int)
Overrides:
wx.ItemContainer.SetSelection (inherited documentation)
这个是设置位置的


当然  也可以用字符串来
SetStringSelection(self, s, select)
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP