Skip to content

progress_bar

pdwidgets.widgets.progress_bar

Progress bar widget.

ProgressBar(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)

Bases: Widget

Horizontal or vertical progress indicator (0–1).

Initialize a ProgressBar widget to display a progress bar.

Parameters:

Name Type Description Default
parent Widget

The parent widget or screen that contains this progress bar.

required
x int

The x-coordinate of the progress bar.

0
y int

The y-coordinate of the progress bar.

0
w int

The width of the progress bar.

None
h int

The height of the progress bar.

None
align int

The alignment of the progress bar.

None
align_to Widget

The widget to align to.

None
fg int

The foreground color of the progress bar.

None
bg int

The background color of the progress bar.

None
visible bool

The visibility of the progress bar.

True
value float

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

0.0
padding tuple

The padding on each side of the progress bar.

None
vertical bool

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

False
reverse bool

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

False
Usage

progress_bar = ProgressBar(screen)

changed()

Invalidate after the progress value changes.

draw(_=None)

Draw the progress bar on the screen.

draw_ends()

Draw the circular ends of the progress bar.