如何确定在WXPYTHON中选择RadioBox中的哪个按钮



我的应用程序中有一个radiobox(盒子里有两个无线电按钮),我需要确定框中选择了哪个按钮。我已经看到了单独创建无线电按钮的示例,但是当它们是RadioBox的一部分时,什么都不是。

这是我的radiobox的代码。

self.radIPAddressInfo = wx.RadioBox(choices=['Automatically Determined',
          'Manual'], id=wxID_FRAME1RADIPADDRESSINFO,
          label=u'IP Address Information', majorDimension=1,
          name=u'radIPAddressInfo', parent=self.panelMain, pos=wx.Point(728,
          80), size=wx.Size(288, 136), style=wx.RA_SPECIFY_COLS)
    self.radIPAddressInfo.Bind(wx.EVT_RADIOBOX,
          self.OnRadIPAddressInfoRadiobox, id=wxID_FRAME1RADIPADDRESSINFO)

我会使用

之类的东西
if self.RadIPAddressInfo.GetValue()="Automatically Determined":
     do something
else
     do something else

谢谢,祝您有美好的一天:)帕特里克。

http://www.wxpython.org/docs/api/wx.radiobox-class.html

print self.RadIPAddressInfo.GetStringSelection(self) #returns selected item string

print self.RadIPAddressInfo.GetSelection()  #returns selected index

最新更新