SpinButtpn gets the old value - is this a GtkSpinButton bug?
- From: <skip pobox com>
- To: gtk-list gnome org
- Cc: pygtk daa com au
- Subject: SpinButtpn gets the old value - is this a GtkSpinButton bug?
- Date: Mon, 7 May 2001 14:35:38 -0500
The appended Python script creates a GtkSpinButton and a GtkButton (I'm
using Gtk 1.3.4 at the moment - haven't had a chance to upgrade to 1.3.5).
If you run the script, click with the mouse in the SpinButton after the "1",
delete it, then focus out of the SpinButton (moving the mouse or using TAB),
the on_change callback gets the wrong value the first time, still printing
"1200" instead of "200". If you hit TAB twice more, focusing back into the
SpinButton then out again, you get the correct value. In fact, it seems the
widget is always one change behind when a focus out event occurs if you use
the mouse and keyboard to change the widget's value. If you use the
spinners to change the value the correct value is displayed on focus out.
Seems like a bug in GtkSpinButton to me, but since I'm still pretty new to
Gtk programming I wanted to run it by the list before filing a bugzilla
report to make sure I wasn't missing something.
--
Skip Montanaro (skip pobox com)
(847)971-7098
import gtk
def test():
window = gtk.GtkWindow(gtk.WINDOW_TOPLEVEL)
window.set_title("title")
window.connect("destroy", gtk.mainquit)
vbox = gtk.GtkVBox(homogeneous=gtk.FALSE)
window.add(vbox)
adj = gtk.GtkAdjustment(1200, 0, 10000, 1.0, 100.0, 0.0)
s1 = gtk.GtkSpinButton(adjustment=adj, digits=0)
s1.connect("focus_out_event", focus_out)
vbox.pack_start(s1)
close = gtk.GtkButton("Quit")
close.connect("clicked", gtk.mainquit)
vbox.pack_start(close, gtk.FALSE, gtk.FALSE, 0)
window.show_all()
gtk.mainloop()
def focus_out(widget, event):
val = widget.get_value_as_float()
if val > 500.0:
print val, "is a big number!"
else:
print val, "isn't so big!"
test()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]