Radio button under OS X generates command event on deselection

All:

Using the following code under OS X, if a button is selected, an event is generated for the deselected button and the selected button. Under GTK and Win98, only the selected button generates an event.

Craig

import wx
class panel(wx.Panel):
     def __init__(self, parent):
         wx.Panel.__init__(self, parent, -1)
         b1 = wx.RadioButton(self, 20, 'One', (10, 10), (50, 20), style=wx.RB_GROUP)
         b2 = wx.RadioButton(self, 21, 'Two', (10, 40), (50, 20))
         self.Bind(wx.EVT_RADIOBUTTON, self.OnRunEvent, b1)
         self.Bind(wx.EVT_RADIOBUTTON, self.OnRunEvent, b2)

     def OnRunEvent(self, event):
         print event.GetInt()

app = wx.PySimpleApp()
f = wx.Frame(None, -1,'Radio Test', (200, 200), (350, 200))
p = panel(f)
f.Show()
app.MainLoop()

Craig Howard wrote:

All:

Using the following code under OS X, if a button is selected, an event is generated for the deselected button and the selected button. Under GTK and Win98, only the selected button generates an event.

Thanks, I'll check in a fix.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!