[pygtk] Which is the active radiobutton?

Brian Rowlands (Greymouth High School) RowlandsB at greyhigh.school.nz
Thu Jun 3 09:38:27 WST 2010


Hi Guys
Just a newbie using Python & Glade and have the code below:

.... some code ... 

class BowlsApp: 
    def __init__(self):
        # set the glade file
        self.builder = gtk.Builder()
        self.builder.add_from_file("Bowls.glade")
        self.window = self.builder.get_object("tournament") 
        self.builder.connect_signals(handles.__dict__)
        
    def __getitem__(self,key):
        # provide link to widgets
        return self.builder.get_object(key)
        
####################################
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> run application
####################################
if __name__ == '__main__':
    cbc = BowlsApp()
    cbc.window.show()
    gtk.main()

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?

Tried print radio.get_label() and that failed as there is no attribute
called label.

Any help appreciated. Even a reference.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20100603/f542305f/attachment.htm 


More information about the pygtk mailing list