Gtk.Range¶
- Subclasses:
Methods¶
- Inherited:
Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Orientable (2)
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Gtk.AccessibleRange (1)
|
|
|
|
|
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/c/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted before clamping a value, to give the application a chance to adjust the bounds. |
|
Emitted when a scroll action is performed on a range. |
|
Virtual function that moves the slider. |
|
Emitted when the range value changes. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gtk.Range(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
GtkRange
is the common base class for widgets which visualize an adjustment.Widgets that are derived from
GtkRange
include [class`Gtk`.Scale] and [class`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 [method`Gtk`.Range.set_fill_level].- get_adjustment()[source]¶
- Returns:
a
GtkAdjustment
- Return type:
Get the adjustment which is the “model” object for
GtkRange
.
- get_fill_level()[source]¶
- Returns:
The current fill level
- Return type:
Gets the current position of the fill level indicator.
- get_flippable()[source]¶
-
Gets whether the
GtkRange
respects text direction.See [method`Gtk`.Range.set_flippable].
- get_range_rect()[source]¶
- Returns:
return location for the range rectangle
- Return type:
range_rect:
Gdk.Rectangle
This function returns the area that contains the range’s trough, in coordinates relative to self's origin.
This function is useful mainly for
GtkRange
subclasses.
- get_round_digits()[source]¶
- Returns:
the number of digits to round to
- Return type:
Gets the number of digits to round the value to when it changes.
See [signal`Gtk`.Range::change-value].
- get_slider_range()[source]¶
- Returns:
- slider_start:
return location for the slider’s start
- slider_end:
return location for the slider’s end
- Return type:
This function returns sliders range along the long dimension, in widget->window coordinates.
This function is useful mainly for
GtkRange
subclasses.
- get_slider_size_fixed()[source]¶
- Returns:
whether the range’s slider has a fixed size.
- Return type:
This function is useful mainly for
GtkRange
subclasses.See [method`Gtk`.Range.set_slider_size_fixed].
- get_value()[source]¶
- Returns:
current value of the range.
- Return type:
Gets the current value of the range.
- set_adjustment(adjustment)[source]¶
- Parameters:
adjustment (
Gtk.Adjustment
) – aGtkAdjustment
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 forGtkScrollbar
, and indicates the size of the visible area of the widget being scrolled. The page size affects the size of the scrollbar slider.
- set_fill_level(fill_level)[source]¶
- Parameters:
fill_level (
float
) – the new position of the fill level indicator
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 [method`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 [method`Gtk`.Range.set_restrict_to_fill_level] and is by default enabled.
- set_flippable(flippable)[source]¶
-
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
Gtk.TextDirection.RTL
.See [method`Gtk`.Widget.get_direction].
- set_increments(step, page)[source]¶
-
Sets the step and page sizes for the range.
The step size is used when the user clicks the
GtkScrollbar
arrows or moves aGtkScale
via arrow keys. The page size is used for example when moving via Page Up or Page Down keys.
- set_inverted(setting)[source]¶
-
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.
- set_range(min, max)[source]¶
-
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.)
- set_restrict_to_fill_level(restrict_to_fill_level)[source]¶
- Parameters:
restrict_to_fill_level (
bool
) – Whether the fill level restricts slider movement.
Sets whether the slider is restricted to the fill level.
See [method`Gtk`.Range.set_fill_level] for a general description of the fill level concept.
- set_round_digits(round_digits)[source]¶
- Parameters:
round_digits (
int
) – the precision in digits, or -1
Sets the number of digits to round the value to when it changes.
See [signal`Gtk`.Range::change-value].
- set_show_fill_level(show_fill_level)[source]¶
- Parameters:
show_fill_level (
bool
) – Whether a fill level indicator graphics is shown.
Sets whether a graphical fill level is show on the trough.
See [method`Gtk`.Range.set_fill_level] for a general description of the fill level concept.
- set_slider_size_fixed(size_fixed)[source]¶
-
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.
- set_value(value)[source]¶
- Parameters:
value (
float
) – new value of the range
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 [signal`Gtk`.Range::value-changed] signal if the value changes.
- do_change_value(scroll, new_value) virtual¶
- Parameters:
scroll (
Gtk.ScrollType
) –new_value (
float
) –
- Return type:
- do_get_range_border(border_) virtual¶
- Parameters:
border (
Gtk.Border
) –
- do_move_slider(scroll) virtual¶
- Parameters:
scroll (
Gtk.ScrollType
) –
- do_value_changed() virtual¶
Signal Details¶
- Gtk.Range.signals.adjust_bounds(range, value)¶
- Signal Name:
adjust-bounds
- Flags:
- Parameters:
Emitted before clamping a value, to give the application a chance to adjust the bounds.
- Gtk.Range.signals.change_value(range, scroll, value)¶
- Signal Name:
change-value
- Flags:
- Parameters:
range (
Gtk.Range
) – The object which received the signalscroll (
Gtk.ScrollType
) – the type of scroll action that was performedvalue (
float
) – the new value resulting from the scroll action
- Returns:
True
to prevent other handlers from being invoked for the signal,False
to propagate the signal further- Return type:
Emitted when a scroll action is performed on a range.
It allows an application to determine the type of scroll event that occurred and the resultant new value. The application can handle the event itself and return
True
to prevent further processing. Or, by returningFalse
, it can pass the event to other handlers until the default GTK handler is reached.The value parameter is unrounded. An application that overrides the
::change-value
signal is responsible for clamping the value to the desired number of decimal digits; the default GTK handler clamps the value based on [property`Gtk`.Range:round-digits].
- Gtk.Range.signals.move_slider(range, step)¶
- Signal Name:
move-slider
- Flags:
- Parameters:
range (
Gtk.Range
) – The object which received the signalstep (
Gtk.ScrollType
) – how to move the slider
Virtual function that moves the slider.
Used for keybindings.
Property Details¶
- Gtk.Range.props.adjustment¶
- Name:
adjustment
- Type:
- Default Value:
- Flags:
The adjustment that is controlled by the range.
- Gtk.Range.props.fill_level¶
- Name:
fill-level
- Type:
- Default Value:
1.7976931348623157e+308
- Flags:
The fill level (e.g. prebuffering of a network stream).
- Gtk.Range.props.inverted¶
- Name:
inverted
- Type:
- Default Value:
- Flags:
If
True
, the direction in which the slider moves is inverted.
- Gtk.Range.props.restrict_to_fill_level¶
- Name:
restrict-to-fill-level
- Type:
- Default Value:
- Flags:
Controls whether slider movement is restricted to an upper boundary set by the fill level.
- Gtk.Range.props.round_digits¶
- Name:
round-digits
- Type:
- Default Value:
-1
- Flags:
The number of digits to round the value to when it changes.
See [signal`Gtk`.Range::change-value].