Gtk.Adjustment¶
class — extends GObject.InitiallyUnowned
A model for a numeric value.
The GtkAdjustment has an associated lower and upper bound.
It also contains step and page increments, and a page size.
Adjustments are used within several GTK widgets, including
SpinButton, Viewport, Scrollbar
and Scale.
The GtkAdjustment object does not update the value itself. Instead
it is left up to the owner of the GtkAdjustment to control the value.
Constructors¶
new¶
@classmethod
def new(cls, value: float, lower: float, upper: float, step_increment: float, page_increment: float, page_size: float) -> Adjustment
Creates a new GtkAdjustment.
Parameters:
value— the initial valuelower— the minimum valueupper— the maximum valuestep_increment— the step incrementpage_increment— the page incrementpage_size— the page size
Methods¶
clamp_page¶
Updates the value of the adjustment to ensure that the given range is contained in the current page.
The current page goes from value to 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 Adjustment.value-changed signal will be emitted
if the value is changed.
Parameters:
lower— the lower valueupper— the upper value
configure¶
def configure(self, value: float, lower: float, upper: float, step_increment: float, page_increment: float, page_size: float) -> None
Sets all properties of the adjustment at once.
Use this function to avoid multiple emissions of the
Adjustment.changed signal. See
Adjustment.set_lower for an alternative
way of compressing multiple emissions of
Adjustment.changed into one.
Parameters:
value— the new valuelower— the new minimum valueupper— the new maximum valuestep_increment— the new step incrementpage_increment— the new page incrementpage_size— the new page size
get_lower¶
Retrieves the minimum value of the adjustment.
get_minimum_increment¶
Gets the smaller of step increment and page increment.
get_page_increment¶
Retrieves the page increment of the adjustment.
get_page_size¶
Retrieves the page size of the adjustment.
get_step_increment¶
Retrieves the step increment of the adjustment.
get_upper¶
Retrieves the maximum value of the adjustment.
get_value¶
Gets the current value of the adjustment.
set_lower¶
Sets the minimum value of the adjustment.
When setting multiple adjustment properties via their individual
setters, multiple Adjustment.changed signals will
be emitted. However, since the emission of the
Adjustment.changed signal is tied to the emission
of the ::notify signals of the changed properties, it’s possible
to compress the Adjustment.changed signals into one
by calling GObject.Object.freeze_notify and GObject.Object.thaw_notify
around the calls to the individual setters.
Alternatively, using a single g_object_set() for all the properties
to change, or using Adjustment.configure has the same effect.
Parameters:
lower— the new minimum value
set_page_increment¶
Sets the page increment of the adjustment.
See Adjustment.set_lower about how to compress
multiple emissions of the Adjustment.changed
signal when setting multiple adjustment properties.
Parameters:
page_increment— the new page increment
set_page_size¶
Sets the page size of the adjustment.
See Adjustment.set_lower about how to compress
multiple emissions of the Adjustment.changed
signal when setting multiple adjustment properties.
Parameters:
page_size— the new page size
set_step_increment¶
Sets the step increment of the adjustment.
See Adjustment.set_lower about how to compress
multiple emissions of the Adjustment.changed
signal when setting multiple adjustment properties.
Parameters:
step_increment— the new step increment
set_upper¶
Sets the maximum value of the adjustment.
Note that values will be restricted by upper - page-size
if the page-size property is nonzero.
See Adjustment.set_lower about how to compress
multiple emissions of the Adjustment.changed
signal when setting multiple adjustment properties.
Parameters:
upper— the new maximum value
set_value¶
Sets the GtkAdjustment value.
The value is clamped to lie between Adjustment.lower
and Adjustment.upper.
Note that for adjustments which are used in a GtkScrollbar,
the effective range of allowed values goes from
Adjustment.lower to
Adjustment.upper - Adjustment.page-size.
Parameters:
value— the new value
Virtual methods¶
do_changed¶
do_value_changed¶
Properties¶
lower¶
The minimum value of the adjustment.
page_increment¶
The page increment of the adjustment.
page_size¶
The page size of the adjustment.
Note that the page-size is irrelevant and should be set to zero
if the adjustment is used for a simple scalar value, e.g. in a
GtkSpinButton.
step_increment¶
The step increment of the adjustment.
upper¶
The maximum value of the adjustment.
Note that values will be restricted by upper - page-size if the page-size
property is nonzero.
value¶
The value of the adjustment.
Signals¶
changed¶
Emitted when one or more of the GtkAdjustment properties have been
changed.
Note that the Adjustment.value property is
covered by the Adjustment.value-changed signal.
value-changed¶
Emitted when the value has been changed.