RadioList

Hi All,

Could someone help a newbie with the code for a radiobox?

I have been working with a raw input;

Name_Number = xrange(int(raw_input("Choose number of Names (1-20)? ")))

for x in Name_Number - Do something etc…

I would now like to use this to give the number of Names

self.radioList = [‘1’, ‘2’, ‘3’, ‘4’, ‘5’]

rb = wxRadioBox(self, 50, “How many names ?”, wxPoint(20, 250), wxDefaultSize,
self.radioList, 3, wxRA_SPECIFY_COLS)
EVT_RADIOBOX(self, 50, self.EvtRadioBox)

Using the demo, I can see how to get what button has been clicked on, but how do I change that to a number for the name list?

def EvtRadioBox(self, event):
self.logger.AppendText(‘EvtRadioBox: %d\n’ % event.GetInt())

Thanks for any help

Malcolm Clift wrote:

Using the demo, I can see how to get what button has been clicked on, but how do I change that to a number for the name list?

  self.rb.GetItemLabel(event.GetInt())

···

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

You can either get the button sequence index (zero-based)
    rb.GetSelection()
or get the label (which in your case represents a number)
and coerce it to an integer
    int(rb.GetString())

- Sam

···

At 2004-09-25 06:03 AM +0100, you wrote:

Hi All,

Could someone help a newbie with the code for a radiobox?

I have been working with a raw input;

Name_Number = xrange(int(raw_input("Choose number of Names (1-20)? ")))

for x in Name_Number - Do something etc...

I would now like to use this to give the number of Names

        self.radioList = ['1', '2', '3', '4', '5']

        rb = wxRadioBox(self, 50, "How many names ?", wxPoint(20, 250), wxDefaultSize,
                        self.radioList, 3, wxRA_SPECIFY_COLS)
        EVT_RADIOBOX(self, 50, self.EvtRadioBox)

Using the demo, I can see how to get what button has been clicked on, but how do I change that to a number for the name list?

    def EvtRadioBox(self, event):
        self.logger.AppendText('EvtRadioBox: %d\n' % event.GetInt())

__________________________________________________________
Spinward Stars, LLC Samuel Reynolds
Software Consulting and Development 303-805-1446
http://SpinwardStars.com/ sam@SpinwardStars.com