Adjustment

class Adjustment(*args, **kwargs)

Superclasses: InitiallyUnowned, Object

GtkAdjustment is 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

class Adjustment
classmethod new(value: float, lower: float, upper: float, step_increment: float, page_increment: float, page_size: float) Adjustment

Creates a new GtkAdjustment.

Parameters:
  • value – the initial value

  • lower – the minimum value

  • upper – the maximum value

  • step_increment – the step increment

  • page_increment – the page increment

  • page_size – the page size

Methods

class Adjustment
clamp_page(lower: float, upper: float) None

Updates the value property to ensure that the range between lower and upper is 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 value_changed signal will be emitted if the value is changed.

Parameters:
  • lower – the lower value

  • upper – the upper value

configure(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 changed signal. See set_lower for an alternative way of compressing multiple emissions of changed into one.

Parameters:
  • 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

get_lower() float

Retrieves the minimum value of the adjustment.

get_minimum_increment() float

Gets the smaller of step increment and page increment.

get_page_increment() float

Retrieves the page increment of the adjustment.

get_page_size() float

Retrieves the page size of the adjustment.

get_step_increment() float

Retrieves the step increment of the adjustment.

get_upper() float

Retrieves the maximum value of the adjustment.

get_value() float

Gets the current value of the adjustment.

set_lower(lower: float) None

Sets the minimum value of the adjustment.

When setting multiple adjustment properties via their individual setters, multiple changed signals will be emitted. However, since the emission of the changed signal is tied to the emission of the ::notify signals of the changed properties, it’s possible to compress the changed signals into one by calling freeze_notify() and thaw_notify() around the calls to the individual setters.

Alternatively, using a single set() for all the properties to change, or using configure has the same effect.

Parameters:

lower – the new minimum value

set_page_increment(page_increment: float) None

Sets the page increment of the adjustment.

See set_lower about how to compress multiple emissions of the changed signal when setting multiple adjustment properties.

Parameters:

page_increment – the new page increment

set_page_size(page_size: float) None

Sets the page size of the adjustment.

See set_lower about how to compress multiple emissions of the changed signal when setting multiple adjustment properties.

Parameters:

page_size – the new page size

set_step_increment(step_increment: float) None

Sets the step increment of the adjustment.

See set_lower about how to compress multiple emissions of the changed signal when setting multiple adjustment properties.

Parameters:

step_increment – the new step increment

set_upper(upper: float) None

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 set_lower about how to compress multiple emissions of the changed signal when setting multiple adjustment properties.

Parameters:

upper – the new maximum value

set_value(value: float) None

Sets the GtkAdjustment value.

The value is clamped to lie between lower and upper.

Note that for adjustments which are used in a GtkScrollbar, the effective range of allowed values goes from lower to upper - page_size.

Parameters:

value – the new value

Properties

class Adjustment
props.lower: float

The minimum value of the adjustment.

props.page_increment: float

The page increment of the adjustment.

props.page_size: float

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.

props.step_increment: float

The step increment of the adjustment.

props.upper: float

The maximum value of the adjustment.

Note that values will be restricted by upper - page-size if the page-size property is nonzero.

props.value: float

The value of the adjustment.

Signals

class Adjustment.signals
changed() None

Emitted when one or more of the GtkAdjustment properties have been changed.

Note that the value property is covered by the value_changed signal.

value_changed() None

Emitted when the value has been changed.

Virtual Methods

class Adjustment
do_changed() None
do_value_changed() None

Fields

class Adjustment
parent_instance