RadioList

Hi Robin,

Sorry, I hadn’t seen your post when I replied to Sam.

Thanks for your help, but as I explained to Sam I’m a complete begginer. Here is the code I have;

class Form1(wxPanel):
def init (self, parent, id):
wxPanel. init (self, parent, id=-1,)

    # Generate
    self.button =wxButton(self, 10, "Generate", wxPoint(200, 300))
    EVT BUTTON(self, 10, self.OnGenerate)
   
    # Name Number
    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)

def OnButton(self, event):       
    Name Number=self.rb.GetItemLabel(event.GetInt())

Using what you gave me gives the following error message;

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

AttributeError: ‘Form1’ object has no attribute ‘rb’

When I change rb to something else such as radioList the message shows no attribute GetItemLabel etc… You can probably see how much of a begginer I am.

Thanks for any help,

Malcolm

Hi Malcom,

Malcolm Clift wrote:

Hi Robin,
Sorry, I hadn't seen your post when I replied to Sam.
Thanks for your help, but as I explained to Sam I'm a complete begginer. Here is the code I have;
<code>

class Form1(wxPanel):
    def init (self, parent, id):
        wxPanel. init (self, parent, id=-1,)

        # Generate
        self.button =wxButton(self, 10, "Generate", wxPoint(200, 300))
        EVT BUTTON(self, 10, self.OnGenerate)
               # Name Number
        self.radioList = ['1', '2', '3', '4', '5']

        rb = wxRadioBox(self, 50, "How many names ?", wxPoint(20, 250), wxDefaultSize,
                        self.radioList, 3, wxRA SPECIFY COLS)

change above to self.rb = ....

               EVT RADIOBOX(self, 50, self.EvtRadioBox)

    def OnButton(self, event): Name Number=self.rb.GetItemLabel(event.GetInt())

Using what you gave me gives the following error message;
     Name_Number=self.rb.GetItemLabel(event.GetInt())
AttributeError: 'Form1' object has no attribute 'rb'
When I change rb to something else such as radioList the message shows no attribute GetItemLabel etc... You can probably see how much of a begginer I am.
Thanks for any help,
Malcolm

See you
Werner