【问题标题】:Get Selected Button from RadioButton Group with Wxpython使用 Wxpython 从 RadioButton 组中获取选定的按钮
【发布时间】:2015-07-04 12:55:35
【问题描述】:

我有两个 wxpython 单选按钮组:

    self.red = wx.RadioButton(panel, -1, 'Red', (10, q2y), style=wx.RB_GROUP)
    self.orange = wx.RadioButton(panel, -1, 'Orange', (50, q2y))
    self.yellow = wx.RadioButton(panel, -1, 'Yellow', (100, q2y))

    self.dot = wx.RadioButton(panel, -1, 'Dot', (10, q3y), style=wx.RB_GROUP)
    self.triangle = wx.RadioButton(panel, -1, 'Triangle', (50, q3y))
    self.rectange = wx.RadioButton(panel, -1, 'Rectangle', (100, q3y))

有没有一种简单的方法可以从每个组中获取选定的单选按钮,而无需遍历所有按钮?

【问题讨论】:

    标签: python python-2.7 radio-button wxpython


    【解决方案1】:

    使用 wx.EVT_RADIOBUTTON 绑定并在事件处理程序中使用 event.GetEventObject 来获取选定的按钮。有关代码示例,请参阅 RadioButton 的 wxPython 演示。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-06-09
      • 2011-11-29
      • 1970-01-01
      • 2018-12-22
      • 1970-01-01
      • 2013-11-27
      • 2011-05-24
      相关资源
      最近更新 更多