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

Osmo Maatta osmoma at gmail.com
Sat Nov 22 04:52:53 WST 2008


Hello,

I need to change the self.width_spin (gtk.SpinButton) value, but in some 
cases I do not want the changed event to fire. How do I set the value?  
This is my code:

        adj = gtk.Adjustment(orig_width, 1, orig_width, 1, 50, 0)
        self.width_spin = gtk.SpinButton(adj, climb_rate=0.0, digits=0)
        self.width_spin.show()
        self.width_spin.set_numeric(True)
        self.width_spin.connect(*"value-changed"*, 
self.image_size_changed_callback, "width")
        hbox1.pack_start(self.width_spin, False, False, 0)

This call will trigger the *"value-changed"* event so I want to avoid it.
    self.width_spin.set_value(some_value)

gtk.SpinButton is derived from gtk.Entry, so if I could grab the entry 
field from gtk.SpinButton so it may be possible to write:
entry.set_data("value", some_value)

Do you know how to do this right?

Am writing a filter/resize/and scale plugin in Python for my screendump 
program http://bildr.no/view/291282. Screendump is written in GTK and c.

TIA
  Osmo Antero (moma)
  Oslo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20081121/e27dc297/attachment.htm 


More information about the pygtk mailing list