On mercredi 05 novembre 2008, Raúl Núñez de Arenas Coronado wrote:

> > Is there a way to set the value of a spinbutton without having
> > its 'value-changed' signal emitted?
>
> Only when using the keyboard to do that, but then you will receive
> "change-value" instead...

I saw that, but I can't use the keyboard (arrows are affected to other 
functions).

> Without further information I assume that your problem is that you have
> a handler for that signal but you don't want that handler to be executed
> if you change the value by program (using "set_value()"). In that case
> you can provide an additional parameter to the handler in the
> "connect()" call and set that parameter to false before setting the
> value by program, thus allowing the handler to perform its actions only
> if the spinner's value is changed by the user. This is tricky, though,
> and may not be a good idea.
>
> If you can elaborate a bit I think we could provide you a better answer.

In fact, I have 2 spinbuttons, with a handler on each one. When I change 
the value of the first, I need to refresh the second, and changing the 
second must update the first. But the way they are refreshed is not 
symetrical; that's why I need to stop the signal when the value is changed 
from teh code (with set_value() method).

You idea seems fine, but I don't see how to implement it, as I use glade 
for building gui, and wTree.signal_autoconnect(myDict) to connect 
signals... Any idea?

It is also possible to block signals, but this needs to know the 
handler_id, which is not possible using glade, am I wrong:

http://www.pygtk.org/pygtk2tutorial/ch-MovingOn.html#sec-MoreOnSignalHandlers

-- 
    Frédéric

    http://www.gbiloba.org
_______________________________________________
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