Gtk.Scrollbar¶
class — extends Widget, Accessible, AccessibleRange, Buildable, ConstraintTarget, Orientable
Shows a horizontal or vertical scrollbar.
<picture> <source srcset="scrollbar-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkScrollbar" src="scrollbar.png"> </picture>
Its position and movement are controlled by the adjustment that is passed to
or created by Scrollbar.new. See Adjustment for more
details. The Adjustment.value field sets the position of the
thumb and must be between Adjustment.lower and
Adjustment.upper - Adjustment.page-size.
The Adjustment.page-size represents the size of the visible
scrollable area.
The fields Adjustment.step-increment and
Adjustment.page-increment fields are added to or subtracted
from the Adjustment.value when the user asks to move by a step
(using e.g. the cursor arrow keys) or by a page (using e.g. the Page Down/Up
keys).
CSS nodes¶
GtkScrollbar has a main CSS node with name scrollbar and a subnode for its
contents. The main node gets the .horizontal or .vertical style classes applied,
depending on the scrollbar's orientation.
The range node gets the style class .fine-tune added when the scrollbar is in 'fine-tuning' mode.
Other style classes that may be added to scrollbars inside
ScrolledWindow include the positional classes (.left, .right,
.top, .bottom) and style classes related to overlay scrolling (.overlay-indicator,
.dragging, .hovering).
Accessibility¶
GtkScrollbar uses the AccessibleRole.scrollbar role.
Constructors¶
new¶
@classmethod
def new(cls, orientation: Orientation | int, adjustment: Adjustment | None = ...) -> Widget
Creates a new scrollbar with the given orientation.
Parameters:
orientation— the scrollbar’s orientation.adjustment— theAdjustmentto use, orNoneto create a new adjustment.
Methods¶
get_adjustment¶
Returns the scrollbar's adjustment.
set_adjustment¶
Makes the scrollbar use the given adjustment.
Parameters:
adjustment— the adjustment to set
Properties¶
adjustment¶
The GtkAdjustment controlled by this scrollbar.