GNOME Bugzilla – Bug 314926
GtkSpinButton is not listening for GtkEntry changes
Last modified: 2018-04-15 00:06:19 UTC
Distribution/Version: Debian Build a GUI with Glade and Simplegladeapp. Add a callback like this def on_timeentry_changed(self, widget, *args): print widget.get_value(), widget.get_text() Type the value 178.3 into the Spinbutton. Move the curser between 7 and 8 in the Spinbutton. Type 3 Result: 178.3 1738.300 If you change the code a bit: def on_timeentry_changed(self, widget, *args): widget.update() print widget.get_value(), widget.get_text() You get: 1738.3 1738.300 So please run the update method in the beginning of the get_value method
Seems to be true. Simplified testcase: sb = gtk.SpinButton() sb.set_range(0, 1) sb.set_text('1') assert sb.get_value() == 1 GtkSpinButton should listen to changes made by gtk_entry_set_text() Moving to gtk+.
the spinbutton does acknowledge entry changes, but only upon focus-out.
This just bit us in the proverbial ass at work today. In particular, if you at trying to fetch the value_as_int in response to a button activated with a mnemonic, which does *not* trigger a focus-out on the GtkSpinButton, so the value is wrong. This is also a problem for us when using dogtail to do UI testing, as dogtail/AT-SPI stuff can trigger a button click without changing the focus away from the GtkSpinButton. Should this really be assigned to nobody@pygtk.org? This is a problem in general with GtkSpinButton (I can provide a simple C test case if you'd like). Thanks in advance.
Threre is workaround for that. You can create two spinbuttons. One you use for display and one for value readout. You have to think about one when to update which one, but this way you can create a wrapper class for gtk.spinbutton that will behave correctly. I know that this is the worst possible solution to the problem, but I will provide a such a wrapper class in Python if somebody feels s/he needs it. Our 1m Telescope is running on that for one year now :-)
*** Bug 312925 has been marked as a duplicate of this bug. ***
*** Bug 143832 has been marked as a duplicate of this bug. ***
Really smart. Bug 143832 was opened 2.5 years ago and contains a test case. How can it possibly be a duplicate of this one is beyond me.
This one (in the form of 14382) has now bitten me. The focus-out behavior doesn't seem very obvious or intuitive to me - I can query the contents of a text entry or position of a slider at any time, but not the value of a spin button? If, however, there is a good reason for this behavior and it shouldn't change, some documentation of this feature, its rationale, and the appopriate workaround (gtk_spin_button_update) in the GtkSpinButton docs would be useful IMO.
*** Bug 409268 has been marked as a duplicate of this bug. ***
*** Bug 507229 has been marked as a duplicate of this bug. ***
*** Bug 642529 has been marked as a duplicate of this bug. ***
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla. If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab: https://gitlab.gnome.org/GNOME/gtk/issues/new