.md →
ProgressBar API#
ProgressBar draws a bar that fills as value climbs towards max_value, with a
color, width, height and an optional value / max readout underneath. The reason it
exists is that it does not depend on ipywidgets, so a loop that assigns bar.value reports
progress the same way in whatever notebook you happen to be running, and it follows the
surrounding light or dark theme.
See also: HTMLRefreshWidget for status text updated in place next to it, AnnotationWidget for the labeling queue that bar is often counting, and PlaySlider when the value should be driven by the reader instead.
Bases: AnyWidget
A customizable progress bar widget for notebooks.
This widget displays a visual progress bar that updates in real-time as
the value attribute changes.
One of the main benefits of this utility is that you have a progress bar that doesn't depend on ipywidgets while you still have something that works across notebook projects.
Attributes:
| Name | Type | Description |
|---|---|---|
value |
int
|
The current progress value. Defaults to 0. |
max_value |
int
|
The maximum value representing 100% completion. Defaults to 100. |
color |
str
|
The fill color of the progress bar. Defaults to '#22c55e'. |
show_text |
bool
|
Whether to show the progress text below the bar. Defaults to True. |
width |
str
|
The CSS width of the progress bar. Defaults to '100%'. |
height |
int
|
The height of the bar in pixels. Defaults to 24. |
Example:
import time
import marimo as mo
from wigglystuff import ProgressBar
progress = mo.ui.anywidget(ProgressBar(value=0, max_value=100))
for i in range(101):
progress.value = i
time.sleep(0.1)
Source code in wigglystuff/html.py
Synced traitlets#
| Traitlet | Type | Notes |
|---|---|---|
value |
int |
The current progress value. Defaults to 0. |
max_value |
int |
The maximum value representing 100% completion. Defaults to 100. |