Gtk.Adjustment

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Adjustment Gtk.Adjustment GObject.InitiallyUnowned->Gtk.Adjustment GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (value, lower, upper, step_increment, page_increment, page_size)

changed ()

clamp_page (lower, upper)

configure (value, lower, upper, step_increment, page_increment, page_size)

get_lower ()

get_minimum_increment ()

get_page_increment ()

get_page_size ()

get_step_increment ()

get_upper ()

get_value ()

set_lower (lower)

set_page_increment (page_increment)

set_page_size (page_size)

set_step_increment (step_increment)

set_upper (upper)

set_value (value)

value_changed ()

Virtual Methods

Inherited:

GObject.Object (7)

do_changed ()

do_value_changed ()

Properties

Name

Type

Flags

Short Description

lower

float

r/w

The minimum value of the adjustment

page-increment

float

r/w

The page increment of the adjustment

page-size

float

r/w

The page size of the adjustment

step-increment

float

r/w

The step increment of the adjustment

upper

float

r/w

The maximum value of the adjustment

value

float

r/w

The value of the adjustment

Signals

Inherited:

GObject.Object (1)

Name

Short Description

changed

Emitted when one or more of the Gtk.Adjustment properties have been changed, other than the Gtk.Adjustment :value property.

value-changed

Emitted when the Gtk.Adjustment :value property has been changed.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.InitiallyUnowned

r

Class Details

class Gtk.Adjustment(*args, **kwargs)
Bases:

GObject.InitiallyUnowned

Abstract:

No

Structure:

Gtk.AdjustmentClass

The Gtk.Adjustment object represents a value which has an associated lower and upper bound, together with step and page increments, and a page size. It is used within several GTK+ widgets, including Gtk.SpinButton, Gtk.Viewport, and Gtk.Range (which is a base class for Gtk.Scrollbar and Gtk.Scale).

The Gtk.Adjustment object does not update the value itself. Instead it is left up to the owner of the Gtk.Adjustment to control the value.

classmethod new(value, lower, upper, step_increment, page_increment, page_size)[source]
Parameters:
  • value (float) – the initial value

  • lower (float) – the minimum value

  • upper (float) – the maximum value

  • step_increment (float) – the step increment

  • page_increment (float) – the page increment

  • page_size (float) – the page size

Returns:

a new Gtk.Adjustment

Return type:

Gtk.Adjustment

Creates a new Gtk.Adjustment.

changed()[source]

Emits a Gtk.Adjustment ::changed signal from the Gtk.Adjustment. This is typically called by the owner of the Gtk.Adjustment after it has changed any of the Gtk.Adjustment properties other than the value.

Deprecated since version 3.18: GTK+ emits Gtk.Adjustment ::changed itself whenever any of the properties (other than value) change

clamp_page(lower, upper)[source]
Parameters:
  • lower (float) – the lower value

  • upper (float) – the upper value

Updates the Gtk.Adjustment :value property to ensure that the range between lower and upper is in the current page (i.e. between Gtk.Adjustment :value and Gtk.Adjustment :value + Gtk.Adjustment :page-size). If the range is larger than the page size, then only the start of it will be in the current page.

A Gtk.Adjustment ::value-changed signal will be emitted if the value is changed.

configure(value, lower, upper, step_increment, page_increment, page_size)[source]
Parameters:
  • value (float) – the new value

  • lower (float) – the new minimum value

  • upper (float) – the new maximum value

  • step_increment (float) – the new step increment

  • page_increment (float) – the new page increment

  • page_size (float) – the new page size

Sets all properties of the adjustment at once.

Use this function to avoid multiple emissions of the Gtk.Adjustment ::changed signal. See Gtk.Adjustment.set_lower() for an alternative way of compressing multiple emissions of Gtk.Adjustment ::changed into one.

New in version 2.14.

get_lower()[source]
Returns:

The current minimum value of the adjustment

Return type:

float

Retrieves the minimum value of the adjustment.

New in version 2.14.

get_minimum_increment()[source]
Returns:

the minimum increment of self

Return type:

float

Gets the smaller of step increment and page increment.

New in version 3.2.

get_page_increment()[source]
Returns:

The current page increment of the adjustment

Return type:

float

Retrieves the page increment of the adjustment.

New in version 2.14.

get_page_size()[source]
Returns:

The current page size of the adjustment

Return type:

float

Retrieves the page size of the adjustment.

New in version 2.14.

get_step_increment()[source]
Returns:

The current step increment of the adjustment.

Return type:

float

Retrieves the step increment of the adjustment.

New in version 2.14.

get_upper()[source]
Returns:

The current maximum value of the adjustment

Return type:

float

Retrieves the maximum value of the adjustment.

New in version 2.14.

get_value()[source]
Returns:

The current value of the adjustment

Return type:

float

Gets the current value of the adjustment. See Gtk.Adjustment.set_value().

set_lower(lower)[source]
Parameters:

lower (float) – the new minimum value

Sets the minimum value of the adjustment.

When setting multiple adjustment properties via their individual setters, multiple Gtk.Adjustment ::changed signals will be emitted. However, since the emission of the Gtk.Adjustment ::changed signal is tied to the emission of the GObject.Object ::notify signals of the changed properties, it’s possible to compress the Gtk.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 Gtk.Adjustment.configure() has the same effect of compressing Gtk.Adjustment ::changed emissions.

New in version 2.14.

set_page_increment(page_increment)[source]
Parameters:

page_increment (float) – the new page increment

Sets the page increment of the adjustment.

See Gtk.Adjustment.set_lower() about how to compress multiple emissions of the Gtk.Adjustment ::changed signal when setting multiple adjustment properties.

New in version 2.14.

set_page_size(page_size)[source]
Parameters:

page_size (float) – the new page size

Sets the page size of the adjustment.

See Gtk.Adjustment.set_lower() about how to compress multiple emissions of the Gtk.Adjustment ::changed signal when setting multiple adjustment properties.

New in version 2.14.

set_step_increment(step_increment)[source]
Parameters:

step_increment (float) – the new step increment

Sets the step increment of the adjustment.

See Gtk.Adjustment.set_lower() about how to compress multiple emissions of the Gtk.Adjustment ::changed signal when setting multiple adjustment properties.

New in version 2.14.

set_upper(upper)[source]
Parameters:

upper (float) – the new maximum value

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

New in version 2.14.

set_value(value)[source]
Parameters:

value (float) – the new value

Sets the Gtk.Adjustment value. The value is clamped to lie between Gtk.Adjustment :lower and Gtk.Adjustment :upper.

Note that for adjustments which are used in a Gtk.Scrollbar, the effective range of allowed values goes from Gtk.Adjustment :lower to Gtk.Adjustment :upper - Gtk.Adjustment :page-size.

value_changed()[source]

Emits a Gtk.Adjustment ::value-changed signal from the Gtk.Adjustment. This is typically called by the owner of the Gtk.Adjustment after it has changed the Gtk.Adjustment :value property.

Deprecated since version 3.18: GTK+ emits Gtk.Adjustment ::value-changed itself whenever the value changes

do_changed() virtual

Emits a Gtk.Adjustment ::changed signal from the Gtk.Adjustment. This is typically called by the owner of the Gtk.Adjustment after it has changed any of the Gtk.Adjustment properties other than the value.

Deprecated since version 3.18: GTK+ emits Gtk.Adjustment ::changed itself whenever any of the properties (other than value) change

do_value_changed() virtual

Emits a Gtk.Adjustment ::value-changed signal from the Gtk.Adjustment. This is typically called by the owner of the Gtk.Adjustment after it has changed the Gtk.Adjustment :value property.

Deprecated since version 3.18: GTK+ emits Gtk.Adjustment ::value-changed itself whenever the value changes

Signal Details

Gtk.Adjustment.signals.changed(adjustment)
Signal Name:

changed

Flags:

RUN_FIRST, NO_RECURSE

Parameters:

adjustment (Gtk.Adjustment) – The object which received the signal

Emitted when one or more of the Gtk.Adjustment properties have been changed, other than the Gtk.Adjustment :value property.

Gtk.Adjustment.signals.value_changed(adjustment)
Signal Name:

value-changed

Flags:

RUN_FIRST, NO_RECURSE

Parameters:

adjustment (Gtk.Adjustment) – The object which received the signal

Emitted when the Gtk.Adjustment :value property has been changed.

Property Details

Gtk.Adjustment.props.lower
Name:

lower

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

The minimum value of the adjustment.

New in version 2.4.

Gtk.Adjustment.props.page_increment
Name:

page-increment

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

The page increment of the adjustment.

New in version 2.4.

Gtk.Adjustment.props.page_size
Name:

page-size

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

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 Gtk.SpinButton.

New in version 2.4.

Gtk.Adjustment.props.step_increment
Name:

step-increment

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

The step increment of the adjustment.

New in version 2.4.

Gtk.Adjustment.props.upper
Name:

upper

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

The maximum value of the adjustment. Note that values will be restricted by upper - page-size if the page-size property is nonzero.

New in version 2.4.

Gtk.Adjustment.props.value
Name:

value

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

The value of the adjustment.

New in version 2.4.