:right-sidebar: True ScaleButton =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: ScaleButton(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Subclasses: :class:`~gi.repository.Gtk.VolumeButton` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.AccessibleRange`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget`, :class:`~gi.repository.Gtk.Orientable` ``GtkScaleButton`` 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 :obj:`~gi.repository.Gtk.VolumeButton` subclass that is tailored for this use case. CSS nodes --------- .. code-block:: :dedent: scalebutton.scale ╰── button.toggle ╰── ``GtkScaleButton`` has a single CSS node with name scalebutton and ``.scale`` style class, and contains a ``button`` node with a ``.toggle`` style class. Constructors ------------ .. rst-class:: interim-class .. class:: ScaleButton :no-index: .. classmethod:: new(min: float, max: float, step: float, icons: ~typing.Sequence[str] | None = None) -> ~gi.repository.Gtk.Widget Creates a ``GtkScaleButton``. The new scale button has a range between ``min`` and ``max``, with a stepping of ``step``. :param min: the minimum value of the scale (usually 0) :param max: the maximum value of the scale (usually 100) :param step: the stepping of value when a scroll-wheel event, or up/down arrow event occurs (usually 2) :param icons: a :const:`None`-terminated array of icon names, or :const:`None` if you want to set the list later with :func:`~gi.repository.Gtk.ScaleButton.set_icons` Methods ------- .. rst-class:: interim-class .. class:: ScaleButton :no-index: .. method:: get_active() -> bool Queries a ``GtkScaleButton`` and returns its current state. Returns :const:`True` if the scale button is pressed in and :const:`False` if it is raised. .. versionadded:: 4.10 .. method:: get_adjustment() -> ~gi.repository.Gtk.Adjustment Gets the ``GtkAdjustment`` associated with the ``GtkScaleButton``’s scale. See :obj:`~gi.repository.Gtk.Range.get_adjustment` for details. .. method:: get_has_frame() -> bool Returns whether the button has a frame. .. versionadded:: 4.14 .. method:: get_minus_button() -> ~gi.repository.Gtk.Button Retrieves the minus button of the ``GtkScaleButton``. .. method:: get_plus_button() -> ~gi.repository.Gtk.Button Retrieves the plus button of the ``GtkScaleButton.`` .. method:: get_popup() -> ~gi.repository.Gtk.Widget Retrieves the popup of the ``GtkScaleButton``. .. method:: get_value() -> float Gets the current value of the scale button. .. method:: set_adjustment(adjustment: ~gi.repository.Gtk.Adjustment) -> None Sets the ``GtkAdjustment`` to be used as a model for the ``GtkScaleButton``’s scale. See :obj:`~gi.repository.Gtk.Range.set_adjustment` for details. :param adjustment: a ``GtkAdjustment`` .. method:: set_has_frame(has_frame: bool) -> None Sets the style of the button. .. versionadded:: 4.14 :param has_frame: whether the button should have a visible frame .. method:: set_icons(icons: ~typing.Sequence[str]) -> None Sets the icons to be used by the scale button. :param icons: a :const:`None`-terminated array of icon names .. method:: set_value(value: float) -> None 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 :obj:`~gi.repository.Gtk.ScaleButton.signals.value_changed` signal if the value changes. :param value: new value of the scale button Properties ---------- .. rst-class:: interim-class .. class:: ScaleButton :no-index: .. attribute:: props.active :type: bool If the scale button should be pressed in. .. versionadded:: 4.10 .. attribute:: props.adjustment :type: ~gi.repository.Gtk.Adjustment The ``GtkAdjustment`` that is used as the model. .. attribute:: props.has_frame :type: bool If the scale button has a frame. .. versionadded:: 4.14 .. attribute:: props.icons :type: ~typing.Sequence[str] 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 ``GtkScaleButton`` reflects the current value of the scale better for the users. .. attribute:: props.value :type: float The value of the scale. Signals ------- .. rst-class:: interim-class .. class:: ScaleButton.signals :no-index: .. method:: popdown() -> None Emitted to dismiss the popup. This is a `keybinding signal `_. The default binding for this signal is :kbd:`Escape`. .. method:: popup() -> None Emitted to popup the scale widget. This is a `keybinding signal `_. The default bindings for this signal are :kbd:`Space`, :kbd:`Enter` and :kbd:`Return`. .. method:: value_changed(value: float) -> None Emitted when the value field has changed. :param value: the new value Virtual Methods --------------- .. rst-class:: interim-class .. class:: ScaleButton :no-index: .. method:: do_value_changed(value: float) -> None :param value: Fields ------ .. rst-class:: interim-class .. class:: ScaleButton :no-index: .. attribute:: parent_instance