On Sun, May 15, 2011 at 10:26:50PM -0400, craf wrote:
> Hi.
> 
> It is possible to prevent the print statement, printed on the screen 2
> times?


sure, it depends on what you want. callback function is called 2 times, one
when one radio is clicked (so that it's toggled) and the other when the
other is toggled as if belongs to the same group.

the callback function prints only for a toggle from True => False otherwise
you would see also a couple of prin forthe simmetrical transition, but
independently from which button triggered the call.

Depending on what you want you can just add an argument to the function and
call directly the correct radiobutton, 

  self.radiobutton.connect('toggled', function, radiobutton)
  self.radiobutton1.connect('toggled', function, radiobutton1)

  def function(butt, radio):
     if radio.get_active():
         print radio

in more complex case I needed to inhibit further processing of the signal:

            self.gtkwidget.handler_block(self._clicked_id)

            self.gtkwidget.set_inconsistent(False)
            self.gtkwidget.set_active(value)

            self.gtkwidget.handler_unblock(self._clicked_id)


your milage may vary, but if you understand why you get it twice it's not
diffucult to change it to your need.


sandro
*:-)

-- 
Sandro Dentella  *:-)
http://www.reteisi.org             Soluzioni libere per le scuole
http://sqlkit.argolinux.org        SQLkit home page - PyGTK/python/sqlalchemy
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to