Radio box doesn't work

Well, I can't believe this. It must be because I have a demo to give next
week.

I can't get a radio box to work in the simplest way. The code is below.
The event handler is never called. You select a button and nothing happens
except that the button in the selection widget changes. Not only is the
event handler never called, but GetSelection() always returns 0.

RadioButtons seem to work just fine.

I don't get it. The demo works. This looks exactly (to me) like the demo
does. What's going on here?

wxPython 2.4.1 on Windows ...

        id = wxNewId()
        self.supportChoice = wxRadioBox( self, id, "", wxDefaultPosition,
wxDefaultSize,
                                         ["None","Low","Medium","High"] ,
1, wxRA_SPECIFY_ROWS )
        self.supportChoice.SetBackgroundColour(props.BKE_LIGHT_BLUE)
        EVT_RADIOBOX(self, id, self.supportSelected)
        parametersSizer.Add( self.supportChoice, 1,
wxGROW>wxALIGN_CENTRE|wxALL, 5 )

and ...

    def supportSelected(self, evt):
        sel = evt.GetInt()
        x = self.supportChoice.GetSelection()
        pass

···

--------------------------------------
Gary H. Merrill
Director and Principal Scientist, New Applications
Data Exploration Sciences
GlaxoSmithKline Inc.
(919) 483-8456

I just banged out something very similar to the above in PyShell with 2.4.2.4 and events are sent fine and GetSelection works too. I'm not sure what could cause problems in your case. Sorry.

···

gary.h.merrill@gsk.com wrote:

I can't get a radio box to work in the simplest way. The code is below.
The event handler is never called. You select a button and nothing happens
except that the button in the selection widget changes. Not only is the
event handler never called, but GetSelection() always returns 0.

RadioButtons seem to work just fine.

I don't get it. The demo works. This looks exactly (to me) like the demo
does. What's going on here?

wxPython 2.4.1 on Windows ...

        id = wxNewId()
        self.supportChoice = wxRadioBox( self, id, "", wxDefaultPosition,
wxDefaultSize,
                                         ["None","Low","Medium","High"] ,
1, wxRA_SPECIFY_ROWS )
        self.supportChoice.SetBackgroundColour(props.BKE_LIGHT_BLUE)
        EVT_RADIOBOX(self, id, self.supportSelected)
        parametersSizer.Add( self.supportChoice, 1,
wxGROW>wxALIGN_CENTRE|wxALL, 5 )

and ...

    def supportSelected(self, evt):
        sel = evt.GetInt()
        x = self.supportChoice.GetSelection()
        pass

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