:right-sidebar: True LevelBar =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: LevelBar(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` 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` :Constructors: :: LevelBar(**properties) new() -> Gtk.Widget new_for_interval(min_value:float, max_value:float) -> Gtk.Widget Constructors ------------ .. rst-class:: interim-class .. class:: LevelBar :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.Widget Creates a new ``GtkLevelBar``. .. classmethod:: new_for_interval(min_value: float, max_value: float) -> ~gi.repository.Gtk.Widget Creates a new ``GtkLevelBar`` for the specified interval. :param min_value: a positive value :param max_value: a positive value Methods ------- .. rst-class:: interim-class .. class:: LevelBar :no-index: .. method:: add_offset_value(name: str, value: float) -> None Adds a new offset marker on ``self`` at the position specified by ``value``. When the bar value is in the interval topped by ``value`` (or between ``value`` and :obj:`~gi.repository.Gtk.LevelBar.props.max_value` in case the offset is the last one on the bar) a style class named `level-```name`` will be applied when rendering the level bar fill. If another offset marker named ``name`` exists, its value will be replaced by ``value``. :param name: the name of the new offset :param value: the value for the new offset .. method:: get_inverted() -> bool Returns whether the levelbar is inverted. .. method:: get_max_value() -> float Returns the ``max-value`` of the ``GtkLevelBar``. .. method:: get_min_value() -> float Returns the ``min-value`` of the ``GtkLevelBar``. .. method:: get_mode() -> ~gi.repository.Gtk.LevelBarMode Returns the ``mode`` of the ``GtkLevelBar``. .. method:: get_offset_value(name: str | None = None) -> tuple[bool, float] Fetches the value specified for the offset marker ``name`` in ``self``. :param name: the name of an offset in the bar .. method:: get_value() -> float Returns the ``value`` of the ``GtkLevelBar``. .. method:: remove_offset_value(name: str | None = None) -> None Removes an offset marker from a ``GtkLevelBar``. The marker must have been previously added with :obj:`~gi.repository.Gtk.LevelBar.add_offset_value`. :param name: the name of an offset in the bar .. method:: set_inverted(inverted: bool) -> None Sets whether the ``GtkLevelBar`` is inverted. :param inverted: :const:`True` to invert the level bar .. method:: set_max_value(value: float) -> None Sets the ``max-value`` of the ``GtkLevelBar``. You probably want to update preexisting level offsets after calling this function. :param value: a positive value .. method:: set_min_value(value: float) -> None Sets the ``min-value`` of the ``GtkLevelBar``. You probably want to update preexisting level offsets after calling this function. :param value: a positive value .. method:: set_mode(mode: ~gi.repository.Gtk.LevelBarMode) -> None Sets the ``mode`` of the ``GtkLevelBar``. :param mode: a ``GtkLevelBarMode`` .. method:: set_value(value: float) -> None Sets the value of the ``GtkLevelBar``. :param value: a value in the interval between :obj:`~gi.repository.Gtk.LevelBar.props.min_value` and :obj:`~gi.repository.Gtk.LevelBar.props.max_value` Properties ---------- .. rst-class:: interim-class .. class:: LevelBar :no-index: .. attribute:: props.inverted :type: bool Whether the ``GtkLeveBar`` is inverted. Level bars normally grow from top to bottom or left to right. Inverted level bars grow in the opposite direction. .. attribute:: props.max_value :type: float Determines the maximum value of the interval that can be displayed by the bar. .. attribute:: props.min_value :type: float Determines the minimum value of the interval that can be displayed by the bar. .. attribute:: props.mode :type: ~gi.repository.Gtk.LevelBarMode Determines the way ``GtkLevelBar`` interprets the value properties to draw the level fill area. Specifically, when the value is :const:`~gi.repository.Gtk.LevelBarMode.CONTINUOUS`, ``GtkLevelBar`` will draw a single block representing the current value in that area; when the value is :const:`~gi.repository.Gtk.LevelBarMode.DISCRETE`, the widget will draw a succession of separate blocks filling the draw area, with the number of blocks being equal to the units separating the integral roundings of :obj:`~gi.repository.Gtk.LevelBar.props.min_value` and :obj:`~gi.repository.Gtk.LevelBar.props.max_value`. .. attribute:: props.value :type: float Determines the currently filled value of the level bar. Signals ------- .. rst-class:: interim-class .. class:: LevelBar.signals :no-index: .. method:: offset_changed(name: str) -> None Emitted when an offset specified on the bar changes value. This typically is the result of a :obj:`~gi.repository.Gtk.LevelBar.add_offset_value` call. The signal supports detailed connections; you can connect to the detailed signal "changed::x" in order to only receive callbacks when the value of offset "x" changes. :param name: the name of the offset that changed value