SpinRow

Added in version 1.4.

class SpinRow(**properties: Any)

Superclasses: ActionRow, PreferencesRow, ListBoxRow, Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Actionable, Buildable, ConstraintTarget, Editable

An ActionRow with an embedded spin button.

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/spin-row.png

Example of an AdwSpinRow UI definition:

<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 SpinButton for details.

CSS nodes

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

Constructors

class SpinRow
classmethod new(adjustment: Adjustment | None, climb_rate: float, digits: int) Widget

Creates a new AdwSpinRow.

Added in version 1.4.

Parameters:
  • adjustment – the adjustment that this spin row should use

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

  • digits – the number of decimal places to display

classmethod new_with_range(min: float, max: float, step: float) 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 set_digits to correct it.

Added in version 1.4.

Parameters:
  • min – minimum allowable value

  • max – maximum allowable value

  • step – increment added or subtracted by spinning the widget

Methods

class SpinRow
configure(adjustment: Adjustment | None, climb_rate: float, digits: int) None

Changes the properties of an existing spin row.

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

Added in version 1.4.

Parameters:
  • adjustment – the adjustment that this spin row should use

  • climb_rate – the new climb rate

  • digits – the number of decimal places to display

get_adjustment() Adjustment

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

Added in version 1.4.

get_climb_rate() float

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

Added in version 1.4.

get_digits() int

Gets the number of decimal places to display.

Added in version 1.4.

get_numeric() bool

Gets whether non-numeric characters should be ignored.

Added in version 1.4.

get_snap_to_ticks() bool

Gets whether invalid values are snapped to nearest step increment.

Added in version 1.4.

get_update_policy() SpinButtonUpdatePolicy

Gets the policy for updating the spin row.

Added in version 1.4.

get_value() float

Gets the current value.

Added in version 1.4.

get_wrap() bool

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

Added in version 1.4.

set_adjustment(adjustment: Adjustment | None = None) None

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

Added in version 1.4.

Parameters:

adjustment – an adjustment

set_climb_rate(climb_rate: float) None

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

Added in version 1.4.

Parameters:

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

set_digits(digits: int) None

Sets the number of decimal places to display.

Added in version 1.4.

Parameters:

digits – the number of decimal places to display

set_numeric(numeric: bool) None

Sets whether non-numeric characters should be ignored.

Added in version 1.4.

Parameters:

numeric – whether non-numeric characters should be ignored

set_range(min: float, max: float) None

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.

Added in version 1.4.

Parameters:
  • min – minimum allowable value

  • max – maximum allowable value

set_snap_to_ticks(snap_to_ticks: bool) None

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

Added in version 1.4.

Parameters:

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

set_update_policy(policy: SpinButtonUpdatePolicy) None

Sets the policy for updating the spin row.

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

Added in version 1.4.

Parameters:

policy – the policy for updating the spin row

set_value(value: float) None

Sets the current value.

Added in version 1.4.

Parameters:

value – a new value

set_wrap(wrap: bool) None

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

Added in version 1.4.

Parameters:

wrap – whether the spin row should wrap upon reaching its limits

update() None

Manually force an update of the spin row.

Added in version 1.4.

Properties

class SpinRow
props.adjustment: Adjustment

The adjustment that holds the value of the spin row.

Added in version 1.4.

props.climb_rate: float

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

Added in version 1.4.

props.digits: int

The number of decimal places to display.

Added in version 1.4.

props.numeric: bool

Whether non-numeric characters should be ignored.

Added in version 1.4.

props.snap_to_ticks: bool

Whether invalid values are snapped to the nearest step increment.

Added in version 1.4.

props.update_policy: SpinButtonUpdatePolicy

The policy for updating the spin row.

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

Added in version 1.4.

props.value: float

The current value.

Added in version 1.4.

props.wrap: bool

Whether the spin row should wrap upon reaching its limits.

Added in version 1.4.

Signals

class SpinRow.signals
input() tuple[int, float]

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

The signal handler is expected to use get_text to retrieve the text of the spinbutton and set new_value to the new value.

The default conversion uses strtod.

See input.

Added in version 1.4.

output() bool

Emitted to tweak the formatting of the value for display.

See output.

Added in version 1.4.

wrapped() None

Emitted right after the spinbutton wraps.

See wrapped.

Added in version 1.4.