Hi.
It is possible to prevent the print statement, printed on the screen 2
times?
Code:-----------------------------------------------------------------
#!/usr/bin/env python
import gtk
class RadioButton:
def __init__(self):
self.window = gtk.Window()
self.vbox = gtk.VBox()
self.radiobutton = gtk.RadioButton(None, "One")
self.radiobutton1 = gtk.RadioButton(self.radiobutton, "Two")
self.radiobutton2 = gtk.RadioButton(self.radiobutton, "Three")
self.window.add(self.vbox)
self.vbox.pack_start(self.radiobutton)
self.vbox.pack_start(self.radiobutton1)
self.vbox.pack_start(self.radiobutton2)
self.window.connect("destroy", lambda w: gtk.main_quit())
self.radiobutton.connect('toggled', lambda e, widget=self:
function(widget))
self.radiobutton1.connect('toggled', lambda e, widget=self:
function(widget))
self.radiobutton2.connect('toggled', lambda e, widget=self:
function(widget))
self.window.show_all()
def function(widget):
if widget.radiobutton.get_active() == True:
print "one"
elif widget.radiobutton1.get_active() == True:
print "Two"
elif widget.radiobutton2.get_active() == True:
print "Three"
RadioButton()
gtk.main()
Regards.
Cristian
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/