[pygtk] Setting value of gtk.SpinButton without triggering the "value-changed" event.

Paul Pogonyshev pogonyshev at gmx.net
Sat Nov 22 05:04:50 WST 2008


Osmo Maatta wrote:
> I need to change the self.width_spin (gtk.SpinButton) value, but in some 
> cases I do not want the changed event to fire. [...]

Actually you don't.  There can be some handlers that you don't know of,
e.g. GTK+ itself can install some handlers for its own purposes.  Then,
if you slip some value change in without the corresponding signal, the
code behind such handlers can break in unpredictable manner.

What you should do instead is to block handlers you don't want to be
run during this change and unblock them afterwards (or disconnect and
the reconnect again).  Or maybe set some internal boolean variable
which means "ignore this change" for your handlers.

Paul


More information about the pygtk mailing list