On Thu, Jun 3, 2010 at 8:05 PM, Timo <[email protected]> wrote:
> On 03-06-10 03:38, Brian Rowlands (Greymouth High School) wrote:
>>
>> Hi Guys
>>
>> Just a newbie using Python & Glade and have the code below:
>>
>> The GUI contains 4 radio buttons [ I'll call them four, three, two,
>> one  ] in a group called four. My research came across:
>>
>> radio = [r for r in cbc['four'].get_group() if r.get_active()]
>>
>> which gets me the active button with print radio giving me:
>>
>> [<gtk.RadioButton object at 0xe903c8 (GtkRadioButton at 0x13ab548)>]
>>
>> My question: how do i get the 'name' of the button which is active?
>>
> Every widget has the get_name() method. You could try that.

This is very likely not what you want, for example get_name() on a
gtk.Dialog returns "GtkDialog"

What I suspect happened was you did this

radio = [r for r in cbc['four'].get_group() if r.get_active()]
radio.get_label()

Which fails because radio is a list (not a gtk radiobutton). You
probably want something like

radio[0].get_label().get_text()

John
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to