LevelBar

class LevelBar(**properties: Any)

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, AccessibleRange, Buildable, ConstraintTarget, Orientable

Constructors:

LevelBar(**properties)
new() -> Gtk.Widget
new_for_interval(min_value:float, max_value:float) -> Gtk.Widget

Constructors

class LevelBar
classmethod new() Widget

Creates a new GtkLevelBar.

classmethod new_for_interval(min_value: float, max_value: float) Widget

Creates a new GtkLevelBar for the specified interval.

Parameters:
  • min_value – a positive value

  • max_value – a positive value

Methods

class LevelBar
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 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.

Parameters:
  • name – the name of the new offset

  • value – the value for the new offset

get_inverted() bool

Returns whether the levelbar is inverted.

get_max_value() float

Returns the max-value of the GtkLevelBar.

get_min_value() float

Returns the min-value of the GtkLevelBar.

get_mode() LevelBarMode

Returns the mode of the GtkLevelBar.

get_offset_value(name: str | None = None) tuple[bool, float]

Fetches the value specified for the offset marker name in self.

Parameters:

name – the name of an offset in the bar

get_value() float

Returns the value of the GtkLevelBar.

remove_offset_value(name: str | None = None) None

Removes an offset marker from a GtkLevelBar.

The marker must have been previously added with add_offset_value.

Parameters:

name – the name of an offset in the bar

set_inverted(inverted: bool) None

Sets whether the GtkLevelBar is inverted.

Parameters:

invertedTrue to invert the level bar

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.

Parameters:

value – a positive value

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.

Parameters:

value – a positive value

set_mode(mode: LevelBarMode) None

Sets the mode of the GtkLevelBar.

Parameters:

mode – a GtkLevelBarMode

set_value(value: float) None

Sets the value of the GtkLevelBar.

Parameters:

value – a value in the interval between min_value and max_value

Properties

class LevelBar
props.inverted: 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.

props.max_value: float

Determines the maximum value of the interval that can be displayed by the bar.

props.min_value: float

Determines the minimum value of the interval that can be displayed by the bar.

props.mode: LevelBarMode

Determines the way GtkLevelBar interprets the value properties to draw the level fill area.

Specifically, when the value is CONTINUOUS, GtkLevelBar will draw a single block representing the current value in that area; when the value is 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 min_value and max_value.

props.value: float

Determines the currently filled value of the level bar.

Signals

class LevelBar.signals
offset_changed(name: str) None

Emitted when an offset specified on the bar changes value.

This typically is the result of a 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.

Parameters:

name – the name of the offset that changed value