Gtk.ScaleButton

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Actionable Gtk.Actionable GObject.GInterface->Gtk.Actionable Gtk.Activatable Gtk.Activatable GObject.GInterface->Gtk.Activatable Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Button Gtk.Button Gtk.Actionable->Gtk.Button Gtk.Activatable->Gtk.Button Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.Button Gtk.Buildable->Gtk.Widget Gtk.ScaleButton Gtk.ScaleButton Gtk.Button->Gtk.ScaleButton Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Orientable->Gtk.ScaleButton Gtk.Widget->Gtk.Container

Subclasses:

Gtk.VolumeButton

Methods

Inherited:

Gtk.Button (29), Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Actionable (5), Gtk.Activatable (6), Gtk.Orientable (2)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new (size, min, max, step, icons)

get_adjustment ()

get_minus_button ()

get_plus_button ()

get_popup ()

get_value ()

set_adjustment (adjustment)

set_icons (icons)

set_value (value)

Virtual Methods

Inherited:

Gtk.Button (6), Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Actionable (4), Gtk.Activatable (2)

do_value_changed (value)

Properties

Inherited:

Gtk.Button (9), Gtk.Container (3), Gtk.Widget (39), Gtk.Actionable (2), Gtk.Activatable (2), Gtk.Orientable (1)

Name

Type

Flags

Short Description

adjustment

Gtk.Adjustment

r/w

The Gtk.Adjustment that contains the current value of this scale button object

icons

[str]

r/w

List of icon names

size

Gtk.IconSize

r/w/en

The icon size

value

float

r/w/en

The value of the scale

Style Properties

Inherited:

Gtk.Button (7), Gtk.Widget (17)

Signals

Inherited:

Gtk.Button (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Short Description

popdown

The ::popdown signal is a keybinding signal which gets emitted to popdown the scale widget.

popup

The ::popup signal is a keybinding signal which gets emitted to popup the scale widget.

value-changed

The ::value-changed signal is emitted when the value field has changed.

Fields

Inherited:

Gtk.Button (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Type

Access

Description

parent

Gtk.Button

r

Class Details

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

Gtk.Button, Gtk.Orientable

Abstract:

No

Structure:

Gtk.ScaleButtonClass

Gtk.ScaleButton provides a button which pops up a scale widget. This kind of widget is commonly used for volume controls in multimedia applications, and GTK+ provides a Gtk.VolumeButton subclass that is tailored for this use case.

CSS nodes

Gtk.ScaleButton has a single CSS node with name button. To differentiate it from a plain Gtk.Button, it gets the .scale style class.

The popup widget that contains the scale has a .scale-popup style class.

classmethod new(size, min, max, step, icons)[source]
Parameters:
  • size (int) – a stock icon size (Gtk.IconSize)

  • min (float) – the minimum value of the scale (usually 0)

  • max (float) – the maximum value of the scale (usually 100)

  • step (float) – the stepping of value when a scroll-wheel event, or up/down arrow event occurs (usually 2)

  • icons ([str] or None) – a None-terminated array of icon names, or None if you want to set the list later with Gtk.ScaleButton.set_icons()

Returns:

a new Gtk.ScaleButton

Return type:

Gtk.Widget

Creates a Gtk.ScaleButton, with a range between min and max, with a stepping of step.

New in version 2.12.

get_adjustment()[source]
Returns:

the adjustment associated with the scale

Return type:

Gtk.Adjustment

Gets the Gtk.Adjustment associated with the Gtk.ScaleButton’s scale. See Gtk.Range.get_adjustment() for details.

New in version 2.12.

get_minus_button()[source]
Returns:

the minus button of the Gtk.ScaleButton as a Gtk.Button

Return type:

Gtk.Button

Retrieves the minus button of the Gtk.ScaleButton.

New in version 2.14.

get_plus_button()[source]
Returns:

the plus button of the Gtk.ScaleButton as a Gtk.Button

Return type:

Gtk.Button

Retrieves the plus button of the Gtk.ScaleButton.

New in version 2.14.

get_popup()[source]
Returns:

the popup of the Gtk.ScaleButton

Return type:

Gtk.Widget

Retrieves the popup of the Gtk.ScaleButton.

New in version 2.14.

get_value()[source]
Returns:

current value of the scale button

Return type:

float

Gets the current value of the scale button.

New in version 2.12.

set_adjustment(adjustment)[source]
Parameters:

adjustment (Gtk.Adjustment) – a Gtk.Adjustment

Sets the Gtk.Adjustment to be used as a model for the Gtk.ScaleButton’s scale. See Gtk.Range.set_adjustment() for details.

New in version 2.12.

set_icons(icons)[source]
Parameters:

icons ([str]) – a None-terminated array of icon names

Sets the icons to be used by the scale button. For details, see the Gtk.ScaleButton :icons property.

New in version 2.12.

set_value(value)[source]
Parameters:

value (float) – new value of the scale button

Sets the current value of the scale; if the value is outside the minimum or maximum range values, it will be clamped to fit inside them. The scale button emits the Gtk.ScaleButton ::value-changed signal if the value changes.

New in version 2.12.

do_value_changed(value) virtual
Parameters:

value (float) –

Signal Details

Gtk.ScaleButton.signals.popdown(scale_button)
Signal Name:

popdown

Flags:

RUN_LAST, ACTION

Parameters:

scale_button (Gtk.ScaleButton) – The object which received the signal

The ::popdown signal is a keybinding signal which gets emitted to popdown the scale widget.

The default binding for this signal is Escape.

New in version 2.12.

Gtk.ScaleButton.signals.popup(scale_button)
Signal Name:

popup

Flags:

RUN_LAST, ACTION

Parameters:

scale_button (Gtk.ScaleButton) – The object which received the signal

The ::popup signal is a keybinding signal which gets emitted to popup the scale widget.

The default bindings for this signal are Space, Enter and Return.

New in version 2.12.

Gtk.ScaleButton.signals.value_changed(scale_button, value)
Signal Name:

value-changed

Flags:

RUN_LAST

Parameters:
  • scale_button (Gtk.ScaleButton) – The object which received the signal

  • value (float) – the new value

The ::value-changed signal is emitted when the value field has changed.

New in version 2.12.

Property Details

Gtk.ScaleButton.props.adjustment
Name:

adjustment

Type:

Gtk.Adjustment

Default Value:

None

Flags:

READABLE, WRITABLE

The Gtk.Adjustment that contains the current value of this scale button object

Gtk.ScaleButton.props.icons
Name:

icons

Type:

[str]

Default Value:

[]

Flags:

READABLE, WRITABLE

The names of the icons to be used by the scale button. The first item in the array will be used in the button when the current value is the lowest value, the second item for the highest value. All the subsequent icons will be used for all the other values, spread evenly over the range of values.

If there’s only one icon name in the icons array, it will be used for all the values. If only two icon names are in the icons array, the first one will be used for the bottom 50% of the scale, and the second one for the top 50%.

It is recommended to use at least 3 icons so that the Gtk.ScaleButton reflects the current value of the scale better for the users.

New in version 2.12.

Gtk.ScaleButton.props.size
Name:

size

Type:

Gtk.IconSize

Default Value:

Gtk.IconSize.SMALL_TOOLBAR

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The icon size

Gtk.ScaleButton.props.value
Name:

value

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The value of the scale