[pygtk] spinbutton set value and signal

Frédéric frederic.mantegazza at gbiloba.org
Thu Nov 6 05:02:59 WST 2008

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 

> 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:




More information about the pygtk mailing list