Adw.SpinRow

g Adw.ActionRow Adw.ActionRow Adw.SpinRow Adw.SpinRow Adw.ActionRow->Adw.SpinRow Adw.PreferencesRow Adw.PreferencesRow Adw.PreferencesRow->Adw.ActionRow GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Actionable Gtk.Actionable GObject.GInterface->Gtk.Actionable Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget Gtk.Editable Gtk.Editable GObject.GInterface->Gtk.Editable GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.ListBoxRow Gtk.ListBoxRow Gtk.Actionable->Gtk.ListBoxRow Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Editable->Adw.SpinRow Gtk.ListBoxRow->Adw.PreferencesRow Gtk.Widget->Gtk.ListBoxRow

Subclasses:

None

Methods

Inherited:

Adw.ActionRow (17), Adw.PreferencesRow (9), Gtk.ListBoxRow (12), Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Actionable (5), Gtk.Editable (27)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new (adjustment, climb_rate, digits)

class

new_with_range (min, max, step)

configure (adjustment, climb_rate, digits)

get_adjustment ()

get_climb_rate ()

get_digits ()

get_numeric ()

get_snap_to_ticks ()

get_update_policy ()

get_value ()

get_wrap ()

set_adjustment (adjustment)

set_climb_rate (climb_rate)

set_digits (digits)

set_numeric (numeric)

set_range (min, max)

set_snap_to_ticks (snap_to_ticks)

set_update_policy (policy)

set_value (value)

set_wrap (wrap)

update ()

Virtual Methods

Inherited:

Adw.ActionRow (1), Gtk.ListBoxRow (1), Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Gtk.Actionable (4), Gtk.Editable (9)

Properties

Inherited:

Adw.ActionRow (6), Adw.PreferencesRow (4), Gtk.ListBoxRow (3), Gtk.Widget (34), Gtk.Accessible (1), Gtk.Actionable (2), Gtk.Editable (8)

Name

Type

Flags

Short Description

adjustment

Gtk.Adjustment

r/w/en

climb-rate

float

r/w/en

digits

int

r/w/en

numeric

bool

r/w/en

snap-to-ticks

bool

r/w/en

update-policy

Gtk.SpinButtonUpdatePolicy

r/w/en

value

float

r/w/en

wrap

bool

r/w/en

Signals

Inherited:

Adw.ActionRow (1), Gtk.ListBoxRow (1), Gtk.Widget (13), GObject.Object (1), Gtk.Editable (3)

Name

Short Description

input

Emitted to convert the user’s input into a double value.

output

Emitted to tweak the formatting of the value for display.

wrapped

Emitted right after the spinbutton wraps.

Fields

Inherited:

Adw.ActionRow (1), Gtk.ListBoxRow (1), Gtk.Widget (13), GObject.Object (1), Gtk.Editable (3)

Class Details

class Adw.SpinRow(**kwargs)
Bases:

Adw.ActionRow, Gtk.Editable

Abstract:

No

Structure:

Adw.SpinRowClass

An [class`ActionRow`] with an embedded spin button.

<picture> <source srcset=”spin-row-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”spin-row.png” alt=”spin-row”> </picture>

Example of an AdwSpinRow UI definition:

``xml <object class=”AdwSpinRow”>

<property name=”title” translatable=”yes”>Spin Row</property> <property name=”adjustment”>

<object class=”GtkAdjustment”>

<property name=”lower”>0</property> <property name=”upper”>100</property> <property name=”value”>50</property> <property name=”page-increment”>10</property> <property name=”step-increment”>1</property>

</object>

</property>

</object> ``

See [class`Gtk`.SpinButton] for details.

CSS nodes

AdwSpinRow has the same structure as [class`ActionRow`], as well as the .spin style class on the main node.

New in version 1.4.

classmethod new(adjustment, climb_rate, digits)
Parameters:
  • adjustment (Gtk.Adjustment or None) – the adjustment that this spin row should use

  • climb_rate (float) – the rate the value changes when holding a button or key

  • digits (int) – the number of decimal places to display

Returns:

the newly created AdwSpinRow

Return type:

Gtk.Widget

Creates a new AdwSpinRow.

New in version 1.4.

classmethod new_with_range(min, max, step)
Parameters:
  • min (float) – minimum allowable value

  • max (float) – maximum allowable value

  • step (float) – increment added or subtracted by spinning the widget

Returns:

the new AdwSpinRow

Return type:

Gtk.Widget

Creates a new AdwSpinRow with the given properties.

This is a convenience constructor that allows creation of a numeric AdwSpinRow without manually creating an adjustment. The value is initially set to the minimum value and a page increment of 10 * step is the default. The precision of the spin row is equivalent to the precisions of step.

::: note The way in which the precision is derived works best if step is a power of ten. If the resulting precision is not suitable for your needs, use [method`SpinRow`.set_digits] to correct it.

New in version 1.4.

configure(adjustment, climb_rate, digits)
Parameters:
  • adjustment (Gtk.Adjustment or None) – the adjustment that this spin row should use

  • climb_rate (float) – the new climb rate

  • digits (int) – the number of decimal places to display

Changes the properties of an existing spin row.

The adjustment, climb rate, and number of decimal places are updated accordingly.

New in version 1.4.

get_adjustment()
Returns:

the adjustment that holds the spin row’s value

Return type:

Gtk.Adjustment

Gets the adjustment that holds the value for the spin row.

New in version 1.4.

get_climb_rate()
Returns:

the acceleration rate when you hold down a button or key

Return type:

float

Gets the acceleration rate when you hold down a button or key.

New in version 1.4.

get_digits()
Returns:

the number of decimal places to display

Return type:

int

Gets the number of decimal places to display.

New in version 1.4.

get_numeric()
Returns:

whether non-numeric characters should be ignored.

Return type:

bool

Gets whether non-numeric characters should be ignored.

New in version 1.4.

get_snap_to_ticks()
Returns:

whether invalid values are snapped to the nearest step increment

Return type:

bool

Gets whether invalid values are snapped to nearest step increment.

New in version 1.4.

get_update_policy()
Returns:

the policy for updating the spin row

Return type:

Gtk.SpinButtonUpdatePolicy

Gets the policy for updating the spin row.

New in version 1.4.

get_value()
Returns:

the current value

Return type:

float

Gets the current value.

New in version 1.4.

get_wrap()
Returns:

whether the spin row should wrap upon reaching its limits

Return type:

bool

Gets whether the spin row should wrap upon reaching its limits.

New in version 1.4.

set_adjustment(adjustment)
Parameters:

adjustment (Gtk.Adjustment or None) – an adjustment

Sets the adjustment that holds the value for the spin row.

New in version 1.4.

set_climb_rate(climb_rate)
Parameters:

climb_rate (float) – the acceleration rate when you hold down a button or key

Sets the acceleration rate when you hold down a button or key.

New in version 1.4.

set_digits(digits)
Parameters:

digits (int) – the number of decimal places to display

Sets the number of decimal places to display.

New in version 1.4.

set_numeric(numeric)
Parameters:

numeric (bool) – whether non-numeric characters should be ignored

Sets whether non-numeric characters should be ignored.

New in version 1.4.

set_range(min, max)
Parameters:
  • min (float) – minimum allowable value

  • max (float) – maximum allowable value

Sets the minimum and maximum allowable values for self.

If the current value is outside this range, it will be adjusted to fit within the range, otherwise it will remain unchanged.

New in version 1.4.

set_snap_to_ticks(snap_to_ticks)
Parameters:

snap_to_ticks (bool) – whether invalid values are snapped to the nearest step increment

Sets whether invalid values are snapped to the nearest step increment.

New in version 1.4.

set_update_policy(policy)
Parameters:

policy (Gtk.SpinButtonUpdatePolicy) – the policy for updating the spin row

Sets the policy for updating the spin row.

The options are always, or only when the value is invalid.

New in version 1.4.

set_value(value)
Parameters:

value (float) – a new value

Sets the current value.

New in version 1.4.

set_wrap(wrap)
Parameters:

wrap (bool) – whether the spin row should wrap upon reaching its limits

Sets whether the spin row should wrap upon reaching its limits.

New in version 1.4.

update()

Manually force an update of the spin row.

New in version 1.4.

Signal Details

Adw.SpinRow.signals.input(spin_row)
Signal Name:

input

Flags:

RUN_LAST

Parameters:

spin_row (Adw.SpinRow) – The object which received the signal

Returns:

TRUE for a successful conversion, FALSE if the input was not handled, and GTK_INPUT_ERROR if the conversion failed.

new_value:

return location for the new value

Return type:

(int, new_value: float)

Emitted to convert the user’s input into a double value.

The signal handler is expected to use [method`Gtk`.Editable.get_text] to retrieve the text of the spinbutton and set new_value to the new value.

The default conversion uses [func`GLib`.strtod].

See [signal`Gtk`.SpinButton::input].

New in version 1.4.

Adw.SpinRow.signals.output(spin_row)
Signal Name:

output

Flags:

RUN_LAST

Parameters:

spin_row (Adw.SpinRow) – The object which received the signal

Returns:

TRUE if the value has been displayed

Return type:

bool

Emitted to tweak the formatting of the value for display.

See [signal`Gtk`.SpinButton::output].

New in version 1.4.

Adw.SpinRow.signals.wrapped(spin_row)
Signal Name:

wrapped

Flags:

RUN_LAST

Parameters:

spin_row (Adw.SpinRow) – The object which received the signal

Emitted right after the spinbutton wraps.

See [signal`Gtk`.SpinButton::wrapped].

New in version 1.4.

Property Details

Adw.SpinRow.props.adjustment
Name:

adjustment

Type:

Gtk.Adjustment

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The adjustment that holds the value of the spin row.

New in version 1.4.

Adw.SpinRow.props.climb_rate
Name:

climb-rate

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The acceleration rate when you hold down a button or key.

New in version 1.4.

Adw.SpinRow.props.digits
Name:

digits

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The number of decimal places to display.

New in version 1.4.

Adw.SpinRow.props.numeric
Name:

numeric

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether non-numeric characters should be ignored.

New in version 1.4.

Adw.SpinRow.props.snap_to_ticks
Name:

snap-to-ticks

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether invalid values are snapped to the nearest step increment.

New in version 1.4.

Adw.SpinRow.props.update_policy
Name:

update-policy

Type:

Gtk.SpinButtonUpdatePolicy

Default Value:

Gtk.SpinButtonUpdatePolicy.ALWAYS

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The policy for updating the spin row.

The options are always, or only when the value is invalid.

New in version 1.4.

Adw.SpinRow.props.value
Name:

value

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The current value.

New in version 1.4.

Adw.SpinRow.props.wrap
Name:

wrap

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the spin row should wrap upon reaching its limits.

New in version 1.4.