:right-sidebar: True Range =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: Range(**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.Scale` 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` ``GtkRange`` is the common base class for widgets which visualize an adjustment. Widgets that are derived from ``GtkRange`` include :obj:`~gi.repository.Gtk.Scale` and :obj:`~gi.repository.Gtk.Scrollbar`\. Apart from signals for monitoring the parameters of the adjustment, ``GtkRange`` provides properties and methods for setting a “fill level” on range widgets. See :obj:`~gi.repository.Gtk.Range.set_fill_level`\. Shortcuts and Gestures -------------------------------------------------------------------------------- The ``GtkRange`` slider is draggable. Holding the :kbd:`Shift` key while dragging, or initiating the drag with a long-press will enable the fine-tuning mode. Methods ------- .. rst-class:: interim-class .. class:: Range :no-index: .. method:: do_adjust_bounds(self, new_value: float) -> None :param new_value: .. method:: do_change_value(self, scroll: ~gi.repository.Gtk.ScrollType, new_value: float) -> bool :param scroll: :param new_value: .. method:: do_get_range_border(self, border_: ~gi.repository.Gtk.Border) -> None :param border_: .. method:: do_move_slider(self, scroll: ~gi.repository.Gtk.ScrollType) -> None :param scroll: .. method:: do_value_changed(self) -> None .. method:: get_adjustment() -> ~gi.repository.Gtk.Adjustment Get the adjustment which is the “model” object for ``GtkRange``\. .. method:: get_fill_level() -> float Gets the current position of the fill level indicator. .. method:: get_flippable() -> bool Gets whether the ``GtkRange`` respects text direction. See :obj:`~gi.repository.Gtk.Range.set_flippable`\. .. method:: get_inverted() -> bool Gets whether the range is inverted. See :obj:`~gi.repository.Gtk.Range.set_inverted`\. .. method:: get_range_rect() -> ~gi.repository.Gdk.Rectangle This function returns the area that contains the range’s trough, in coordinates relative to ``range``\'s origin. This function is useful mainly for ``GtkRange`` subclasses. .. method:: get_restrict_to_fill_level() -> bool Gets whether the range is restricted to the fill level. .. method:: get_round_digits() -> int Gets the number of digits to round the value to when it changes. See :obj:`~gi.repository.Gtk.Range.signals.change_value`\. .. method:: get_show_fill_level() -> bool Gets whether the range displays the fill level graphically. .. method:: get_slider_range() -> ~typing.Tuple[int, int] This function returns sliders range along the long dimension, in widget->window coordinates. This function is useful mainly for ``GtkRange`` subclasses. .. method:: get_slider_size_fixed() -> bool This function is useful mainly for ``GtkRange`` subclasses. See :obj:`~gi.repository.Gtk.Range.set_slider_size_fixed`\. .. method:: get_value() -> float Gets the current value of the range. .. method:: set_adjustment(adjustment: ~gi.repository.Gtk.Adjustment) -> None Sets the adjustment to be used as the “model” object for the ``GtkRange`` The adjustment indicates the current range value, the minimum and maximum range values, the step/page increments used for keybindings and scrolling, and the page size. The page size is normally 0 for ``GtkScale`` and nonzero for ``GtkScrollbar``\, and indicates the size of the visible area of the widget being scrolled. The page size affects the size of the scrollbar slider. :param adjustment: a ``GtkAdjustment`` .. method:: set_fill_level(fill_level: float) -> None Set the new position of the fill level indicator. The “fill level” is probably best described by its most prominent use case, which is an indicator for the amount of pre-buffering in a streaming media player. In that use case, the value of the range would indicate the current play position, and the fill level would be the position up to which the file/stream has been downloaded. This amount of prebuffering can be displayed on the range’s trough and is themeable separately from the trough. To enable fill level display, use :obj:`~gi.repository.Gtk.Range.set_show_fill_level`\. The range defaults to not showing the fill level. Additionally, it’s possible to restrict the range’s slider position to values which are smaller than the fill level. This is controlled by :obj:`~gi.repository.Gtk.Range.set_restrict_to_fill_level` and is by default enabled. :param fill_level: the new position of the fill level indicator .. method:: set_flippable(flippable: bool) -> None Sets whether the ``GtkRange`` respects text direction. If a range is flippable, it will switch its direction if it is horizontal and its direction is :const:`~gi.repository.Gtk.TextDirection.RTL`. See :obj:`~gi.repository.Gtk.Widget.get_direction`\. :param flippable: :const:`True` to make the range flippable .. method:: set_increments(step: float, page: float) -> None Sets the step and page sizes for the range. The step size is used when the user clicks the ``GtkScrollbar`` arrows or moves a ``GtkScale`` via arrow keys. The page size is used for example when moving via Page Up or Page Down keys. :param step: step size :param page: page size .. method:: set_inverted(setting: bool) -> None Sets whether to invert the range. Ranges normally move from lower to higher values as the slider moves from top to bottom or left to right. Inverted ranges have higher values at the top or on the right rather than on the bottom or left. :param setting: :const:`True` to invert the range .. method:: set_range(min: float, max: float) -> None Sets the allowable values in the ``GtkRange``\. The range value is clamped to be between ``min`` and ``max``\. (If the range has a non-zero page size, it is clamped between ``min`` and ``max`` - page-size.) :param min: minimum range value :param max: maximum range value .. method:: set_restrict_to_fill_level(restrict_to_fill_level: bool) -> None Sets whether the slider is restricted to the fill level. See :obj:`~gi.repository.Gtk.Range.set_fill_level` for a general description of the fill level concept. :param restrict_to_fill_level: Whether the fill level restricts slider movement. .. method:: set_round_digits(round_digits: int) -> None Sets the number of digits to round the value to when it changes. See :obj:`~gi.repository.Gtk.Range.signals.change_value`\. :param round_digits: the precision in digits, or -1 .. method:: set_show_fill_level(show_fill_level: bool) -> None Sets whether a graphical fill level is show on the trough. See :obj:`~gi.repository.Gtk.Range.set_fill_level` for a general description of the fill level concept. :param show_fill_level: Whether a fill level indicator graphics is shown. .. method:: set_slider_size_fixed(size_fixed: bool) -> None Sets whether the range’s slider has a fixed size, or a size that depends on its adjustment’s page size. This function is useful mainly for ``GtkRange`` subclasses. :param size_fixed: :const:`True` to make the slider size constant .. method:: set_value(value: float) -> None Sets the current value of the range. If the value is outside the minimum or maximum range values, it will be clamped to fit inside them. The range emits the :obj:`~gi.repository.Gtk.Range.signals.value_changed` signal if the value changes. :param value: new value of the range Properties ---------- .. rst-class:: interim-class .. class:: Range :no-index: .. attribute:: props.adjustment :type: ~gi.repository.Gtk.Adjustment The type of the None singleton. .. attribute:: props.fill_level :type: float The type of the None singleton. .. attribute:: props.inverted :type: bool The type of the None singleton. .. attribute:: props.restrict_to_fill_level :type: bool The type of the None singleton. .. attribute:: props.round_digits :type: int The type of the None singleton. .. attribute:: props.show_fill_level :type: bool The type of the None singleton. Signals ------- .. rst-class:: interim-class .. class:: Range.signals :no-index: .. method:: adjust_bounds(value: float) -> None The type of the None singleton. :param value: the value before we clamp .. method:: change_value(scroll: ~gi.repository.Gtk.ScrollType, value: float) -> bool The type of the None singleton. :param scroll: the type of scroll action that was performed :param value: the new value resulting from the scroll action .. method:: move_slider(step: ~gi.repository.Gtk.ScrollType) -> None The type of the None singleton. :param step: how to move the slider .. method:: value_changed() -> None The type of the None singleton. Virtual Methods --------------- .. rst-class:: interim-class .. class:: Range :no-index: .. method:: do_adjust_bounds(new_value: float) -> None The type of the None singleton. :param new_value: .. method:: do_change_value(scroll: ~gi.repository.Gtk.ScrollType, new_value: float) -> bool The type of the None singleton. :param scroll: :param new_value: .. method:: do_get_range_border(border_: ~gi.repository.Gtk.Border) -> None The type of the None singleton. :param border_: .. method:: do_move_slider(scroll: ~gi.repository.Gtk.ScrollType) -> None The type of the None singleton. :param scroll: .. method:: do_value_changed() -> None The type of the None singleton. Fields ------ .. rst-class:: interim-class .. class:: Range :no-index: .. attribute:: parent_instance