-----Mensaje original-----
De: Alessandro Dentella <[email protected]>
Para: craf <[email protected]>
Cc: Python Pygtk <[email protected]>
Asunto: Re: [pygtk] sentence twice impression
Fecha: Mon, 16 May 2011 09:13:49 +0200
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
>*:-)
Hi Alessandro.
Thank you very much for your response!.
Regards.
Cristian
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/