wxRadioButton bug on windows?

Hello,
sorry if this has already been discussed, but I couldn't find any reference.
Anyway, here's the smallest example I could be able to produce that shows a very strange behaviour:

from wxPython.wx import *

class Frame(wxFrame):
    def __init__(self):
        wxFrame.__init__(self, None, -1, "Radio Bug", size=(300, 160))
        radio_1 = wxRadioButton(self, -1, "Radio 1", pos=(0, 0))
        radio_2 = wxRadioButton(self, -1, "Radio 2", pos=(0, 30))
        self.panel = wxPanel(self, -1, pos=(0, 60), size=(300, 100))
        wxButton(self.panel, -1, "button", pos=(100, 30))

        radio_1.SetValue(1)
        self.panel.Enable(False)
        
        EVT_RADIOBUTTON(self, radio_1.GetId(), self.on_radio)
        EVT_RADIOBUTTON(self, radio_2.GetId(), self.on_radio)

    def on_radio(self, event):
        self.panel.Enable(not self.panel.IsEnabled())
        
if __name__ == '__main__':
    app = wxPySimpleApp(0)
    frame = Frame()
    frame.Show()
    app.MainLoop()

This happens on Windows Me, Python 2.2.2 and wxPython 2.3.3.1: after a couple of clicks on the radio buttons, the window "freezes" and there's no choice other than killing it to exit. This does not happen on GTK. Note that if I replace the radio buttons with checkboxes, everything works fine.
Any suggestions?

Cheers,
Alberto Griggio

The radio buttons should be in their own panel. Try this:

class Frame(wxFrame):
    def __init__(self):
        wxFrame.__init__(self, None, -1, "Radio Bug",
                         size=(300, 160))
        panel0 = wxPanel(self, -1, pos =(0,0), size=(300,60))
        radio_1 = wxRadioButton(panel0, -1, "Radio 1", pos=(0, 0))
        radio_2 = wxRadioButton(panel0, -1, "Radio 2", pos=(0, 30))
        self.panel = wxPanel(self, -1, pos=(0, 60), size=(300,
100))
        wxButton(self.panel, -1, "button", pos=(100, 30))

        radio_1.SetValue(1)
        self.panel.Enable(False)
        
        EVT_RADIOBUTTON(self, radio_1.GetId(), self.on_radio)
        EVT_RADIOBUTTON(self, radio_2.GetId(), self.on_radio)

    def on_radio(self, event):
        self.panel.Enable(not self.panel.IsEnabled())

···

--- Alberto Griggio <albgrig@tiscalinet.it> wrote:

Hello,
sorry if this has already been discussed, but I couldn't find any
reference.
Anyway, here's the smallest example I could be able to produce
that shows a very strange behaviour:

from wxPython.wx import *

class Frame(wxFrame):
    def __init__(self):
        wxFrame.__init__(self, None, -1, "Radio Bug", size=(300,
160))
        radio_1 = wxRadioButton(self, -1, "Radio 1", pos=(0, 0))
        radio_2 = wxRadioButton(self, -1, "Radio 2", pos=(0, 30))
        self.panel = wxPanel(self, -1, pos=(0, 60), size=(300,
100))
        wxButton(self.panel, -1, "button", pos=(100, 30))

        radio_1.SetValue(1)
        self.panel.Enable(False)
        
        EVT_RADIOBUTTON(self, radio_1.GetId(), self.on_radio)
        EVT_RADIOBUTTON(self, radio_2.GetId(), self.on_radio)

    def on_radio(self, event):
        self.panel.Enable(not self.panel.IsEnabled())
        
if __name__ == '__main__':
    app = wxPySimpleApp(0)
    frame = Frame()
    frame.Show()
    app.MainLoop()

This happens on Windows Me, Python 2.2.2 and wxPython 2.3.3.1:
after a couple of clicks on the radio buttons, the window
"freezes" and there's no choice other than killing it to exit.
This does not happen on GTK. Note that if I replace the radio
buttons with checkboxes, everything works fine.
Any suggestions?

=====
Donnal Walter
Arkansas Children's Hospital

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.