使用 wxpython 的单选按钮
我正在使用 wxpython 构建一个 gui.. 其中有按钮和单选按钮,我想
根据 gui 中小部件的当前值来执行此类任务.. 插入
按钮有多个 if 语句其中之一if 语句用于检查
单选按钮是否被选中。我不想将事件绑定到单选按钮,所以我已经
在插入按钮中检查了它,使用
这是定义的单选按钮
self.rb1 = wx.RadioButton(self.panel, -1, 'Is this a required pre_action to the next
step?', (5, 220))
,这是检查条件
if self.rb1.GetValue():
# do something here
,而且:
if self.rb1.GetValue() == 'True':
# do some tasks
在两种方式(已经相同)中什么都没有当我选择单选按钮
rb1 时发生!那么这有什么问题呢?
I'm Building a gui using wxpython.. i have buttons and radiobuttons in it, and i wanna
to do such tasks based on what the current values of the widgets in the gui .. the insert
button has a multiple if statement one of these if statement is to check whether a
radiobutton is selected. i dont want to bind an event to the radio button so i have
checked about it in the insert button using
this is the defined radion button
self.rb1 = wx.RadioButton(self.panel, -1, 'Is this a required pre_action to the next
step?', (5, 220))
and this is the check condition
if self.rb1.GetValue():
# do something here
and also :
if self.rb1.GetValue() == 'True':
# do some tasks
in both way (which is already the same) the is nothing happend when i choose the radio
button rb1 ! so what is the problwm of this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道什么对你不起作用。它对我来说效果很好。请参阅下面的示例代码:
I don't know what that doesn't work for you. It works for me just fine. See sample code below: