gtk.Adjustment — an object representing an adjustable bounded value
class gtk.Adjustment(gtk.Object): |
These properties are available in GTK+ 2.4 and above. The GTK+ version is contained in the 3-tuple gtk.gtk_version.
|
|
gobject.GObject Signal Prototypes
"changed" | def callback( |
"value-changed" | def callback( |
The gtk.Adjustment
object contains a value which has an associated lower and upper bound,
together with step and page increments, and a page size. It is used in
conjunction with several PyGTK widgets, including gtk.SpinButton
,
gtk.Viewport
,
and gtk.Range
(which
is a base class for gtk.HScrollbar
,
gtk.VScrollbar
,
gtk.HScale
, and
gtk.VScale
).
A gtk.Adjustment
can be shared by multiple widgets. The gtk.Adjustment
object does not update the value itself. Instead it is left up to the
associated widget(s) that use the gtk.Adjustment
to control the value.
The widget using the gtk.Adjustment
typically calls the value_changed
()
or changed
()
methods after changing the value or its bounds. This results in the emission
of the "value_changed" or "changed" signal respectively.
A gtk.Adjustment
object contains several attributes that provide access to its value and
bounds:
The attribute values can be retrieved and set similar to:
adjustment.upper = 25.0 lower = adjustment.lower
gtk.Adjustment(value
=0, lower
=0, upper
=0, step_incr
=0, page_incr
=0, page_size
=0)
value : | the initial value. |
lower : | the minimum value. |
upper : | the maximum value. |
step_incr : | the step increment. |
page_incr : | the page increment. |
page_size : | the page size. |
Returns : | a new gtk.Adjustment object |
gtk.Adjustment
() creates a new gtk.Adjustment
object with the specified attributes. Any attributes not specified are set
to 0.0 by default.
def set_all(value
, lower
, upper
, step_increment
, page_increment
, page_size
)
value : | the new value. |
lower : | the new minimum value. |
upper : | the new maximum value. |
step_increment : | the new step increment. |
page_increment : | the new page increment. |
page_size : | the new page size. |
The set_all
() method sets the
attributes of the adjustment to the specified values.
def changed()
The changed
() method emits a "changed"
signal from the adjustment. This must typically be called if any of the
adjustment attributes other than value has changed so that the widget(s)
using the adjustment can reflect the changes. Applications usually will not
need to use this method since setting the attributes directly will automatically
invoke this method.
def value_changed()
The value_changed
() method emits a
"value_changed" signal from the adjustment. This must typically be called
after the value attribute of the adjustment has changed. Applications
usually will not need to use this method since setting the attribute
directly will automatically invoke this method as will using the set_value
()
method.
def clamp_page(lower
, upper
)
lower : | the lower value |
upper : | the upper value |
The clamp_page
() method updates the
adjustment value to ensure that the range between
lower
and upper
is in the
current page (i.e. between value and value + page_size). If the range is
larger than the page size, then only the start of it will be in the current
page. A "changed" signal will be emitted if the value is changed.
def callback(adjustment
, user_param1
, ...
)
adjustment : | the object that received the signal |
user_param1 : | the first user parameter (if any) specified
with the connect ()
method |
... : | additional user parameters (if any) |
The "changed" signal is emitted when one (or more) of the adjustment attributes (except the value attribute) has changed.
def callback(adjustment
, user_param1
, ...
)
adjustment : | the object that received the signal |
user_param1 : | the first user parameter (if any) specified
with the connect ()
method |
... : | additional user parameters (if any) |
The "value-changed" signal is emitted when the adjustment value attribute has changed.