[pygtk] Which is the active radiobutton?
john.stowers.lists at gmail.com
Thu Jun 3 18:03:36 WST 2010
On Thu, Jun 3, 2010 at 8:05 PM, Timo <timomlists at gmail.com> 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()]
Which fails because radio is a list (not a gtk radiobutton). You
probably want something like
More information about the pygtk