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)

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)

Virtual Methods

Inherited:

GObject.Object (7)

do_changed ()

do_value_changed ()

Properties

Name

Type

Flags

Short Description

lower

float

r/w

page-increment

float

r/w

page-size

float

r/w

step-increment

float

r/w

upper

float

r/w

value

float

r/w

Signals

Inherited:

GObject.Object (1)

Name

Short Description

changed

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

value-changed

Emitted when the value 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

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 [class`Gtk`.SpinButton], [class`Gtk`.Viewport], [class`Gtk`.Scrollbar] and [class`Gtk`.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.

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 GtkAdjustment

Return type:

Gtk.Adjustment

Creates a new GtkAdjustment.

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

  • upper (float) – the upper value

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 [signal`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 [signal`Gtk`.Adjustment::changed] signal. See [method`Gtk`.Adjustment.set_lower] for an alternative way of compressing multiple emissions of [signal`Gtk`.Adjustment::changed] into one.

get_lower()[source]
Returns:

The current minimum value of the adjustment

Return type:

float

Retrieves the minimum value of the adjustment.

get_minimum_increment()[source]
Returns:

the minimum increment of self

Return type:

float

Gets the smaller of step increment and page increment.

get_page_increment()[source]
Returns:

The current page increment of the adjustment

Return type:

float

Retrieves the page increment of the adjustment.

get_page_size()[source]
Returns:

The current page size of the adjustment

Return type:

float

Retrieves the page size of the adjustment.

get_step_increment()[source]
Returns:

The current step increment of the adjustment.

Return type:

float

Retrieves the step increment of the adjustment.

get_upper()[source]
Returns:

The current maximum value of the adjustment

Return type:

float

Retrieves the maximum value of the adjustment.

get_value()[source]
Returns:

The current value of the adjustment

Return type:

float

Gets the current value of the adjustment.

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 [signal`Gtk`.Adjustment::changed] signals will be emitted. However, since the emission of the [signal`Gtk`.Adjustment::changed] signal is tied to the emission of the ::notify signals of the changed properties, it’s possible to compress the [signal`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 [method`Gtk`.Adjustment.configure] has the same effect.

set_page_increment(page_increment)[source]
Parameters:

page_increment (float) – the new page increment

Sets the page increment of the adjustment.

See [method`Gtk`.Adjustment.set_lower] about how to compress multiple emissions of the [signal`Gtk`.Adjustment::changed] signal when setting multiple adjustment properties.

set_page_size(page_size)[source]
Parameters:

page_size (float) – the new page size

Sets the page size of the adjustment.

See [method`Gtk`.Adjustment.set_lower] about how to compress multiple emissions of the [signal`Gtk`.Adjustment::changed] signal when setting multiple adjustment properties.

set_step_increment(step_increment)[source]
Parameters:

step_increment (float) – the new step increment

Sets the step increment of the adjustment.

See [method`Gtk`.Adjustment.set_lower] about how to compress multiple emissions of the [signal`Gtk`.Adjustment::changed] signal when setting multiple adjustment properties.

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

set_value(value)[source]
Parameters:

value (float) – the new value

Sets the GtkAdjustment value.

The value is clamped to lie between [property`Gtk`.Adjustment:lower] and [property`Gtk`.Adjustment:upper].

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

do_changed() virtual
do_value_changed() virtual

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 GtkAdjustment properties have been changed.

Note that the [property`Gtk`.Adjustment:value] property is covered by the [signal`Gtk`.Adjustment::value-changed] signal.

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 value 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.

Gtk.Adjustment.props.page_increment
Name:

page-increment

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

The page increment of the adjustment.

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 GtkSpinButton.

Gtk.Adjustment.props.step_increment
Name:

step-increment

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

The step increment of the adjustment.

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.

Gtk.Adjustment.props.value
Name:

value

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

The value of the adjustment.