Skip to content

scroll_bar

pdwidgets.widgets.scroll_bar

Scrollbar widget.

ScrollBar(parent, x=0, y=0, w=None, h=None, align=None, align_to=None, fg=None, bg=None, visible=True, value=0.0, padding=None, vertical=False, reverse=False, knob_color=None, step=0.1)

Bases: Widget

Scroll control with end arrows and a central slider.

Initialize a ScrollBar widget with two arrow IconButtons and a Slider.

Parameters:

Name Type Description Default
parent Widget

The parent widget or screen that contains this scroll bar.

required
x int

The x-coordinate of the scroll bar.

0
y int

The y-coordinate of the scroll bar.

0
w int

The width of the scroll bar.

None
h int

The height of the scroll bar.

None
align int

The alignment of the scroll bar.

None
align_to Widget

The widget to align to.

None
fg int

The foreground color of the scroll bar.

None
bg int

The background color of the scroll bar.

None
visible bool

The visibility of the scroll bar.

True
value float

The initial value of the scroll bar (0 to 1).

0.0
padding tuple

The padding on each side of the scroll bar.

None
vertical bool

Whether the scroll bar is vertical (True) or horizontal (False).

False
reverse bool

Whether the scroll bar is reversed (True) or not (False).

False
knob_color int

The color of the knob.

None
step float

The step size for value adjustments.

0.1
Usage

scroll_bar = ScrollBar(screen, vertical=True, step=0.1)