: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. Shortcuts and Gestures -------------------------------------------------------------------------------- The following signals have default keybindings: - :obj:`~gi.repository.Gtk.ScaleButton.signals.popup` 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: list[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:: do_value_changed(self, value: float) -> None :param value: .. 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: list[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 The type of the None singleton. .. versionadded:: 4.10 .. attribute:: props.adjustment :type: ~gi.repository.Gtk.Adjustment The type of the None singleton. .. attribute:: props.has_frame :type: bool The type of the None singleton. .. versionadded:: 4.14 .. attribute:: props.icons :type: list[str] The type of the None singleton. .. attribute:: props.value :type: float The type of the None singleton. Signals ------- .. rst-class:: interim-class .. class:: ScaleButton.signals :no-index: .. method:: popdown() -> None The type of the None singleton. .. method:: popup() -> None The type of the None singleton. .. method:: value_changed(value: float) -> None The type of the None singleton. :param value: the new value Virtual Methods --------------- .. rst-class:: interim-class .. class:: ScaleButton :no-index: .. method:: do_value_changed(value: float) -> None The type of the None singleton. :param value: Fields ------ .. rst-class:: interim-class .. class:: ScaleButton :no-index: .. attribute:: parent_instance