lower upper value step_increment page_increment page_size
Given a GtkAdjustment instance adj, each of the attributes are retrieved by adj.lower, adj.value, etc.
Since, when you set the value
of an adjustment, you generally want the change to be reflected by every
widget that uses this adjustment, PyGTK provides a method to do this:
As mentioned earlier, Adjustment is a
subclass of Object just like all the various widgets, and thus it is able
to emit signals. This is, of course, why updates happen automagically when
you share an adjustment object between a scrollbar and another adjustable
widget; all adjustable widgets connect signal handlers to their adjustment's
signal, as can your program. Here's the definition of this signal callback:
The various widgets that use the Adjustment
object will emit this signal on an adjustment whenever they change its
value. This happens both when user input causes the slider to move on a
range widget, as well as when the program explicitly changes the value
with the set_value() method.
So, for example, if you have a scale widget, and you want to change the
rotation of a picture whenever its value changes, you would create a callback
def cb_rotate_picture(adj, picture): set_picture_rotation (picture, adj.value) ...
and connect it to the scale widget's adjustment
adj.connect("value_changed", cb_rotate_picture, picture)
What about when a widget reconfigures
the upper or lower
fields of its adjustment, such as when a user adds more text to a text
widget? In this case, it emits the changed signal, which looks
Range widgets typically connect a handler to this signal, which changes their appearance to reflect the change - for example, the size of the slider in a scrollbar will grow or shrink in inverse proportion to the difference between the lower and upper values of its adjustment.
You probably won't ever need to attach
a handler to this signal, unless you're writing a new type of range widget.
However, if you change any of the values in a Adjustment directly, you
should emit this signal on it to reconfigure whatever widgets are using
it, like this:
Now go forth and adjust!