SimpleProgress¶
SimpleProgress shows progress as a raw count, like “5 of 47”.
Reach for it when the counts themselves are useful information, not
just their ratio. format controls the rendering (default
%(value_s)s of %(max_value_s)s).
- class progressbar.widgets.SimpleProgress(format='%(value_s)s of %(max_value_s)s', **kwargs: Any)[source]
Bases:
FormatWidgetMixin,ColoredMixin,WidgetBaseReturns progress as a count of the total (e.g.: “5 of 47”).
Create a SimpleProgress with the given format string.
Example¶
"""``SimpleProgress`` shows progress as a raw count, like "5 of 47".
Reach for it when the counts themselves are useful information, not
just their ratio -- compare ``Percentage`` for the ratio alone, and
``UnitProgress`` for the same count with a unit label attached.
"""
import time
import progressbar
STEPS = 24
def main() -> None:
widgets = [progressbar.SimpleProgress()]
with progressbar.ProgressBar(max_value=STEPS, widgets=widgets) as bar:
for step in range(STEPS):
bar.update(step + 1)
time.sleep(0.005)
if __name__ == '__main__':
main()
See also¶
Percentage: the ratio alone, when the raw counts do not matter.
UnitProgress: the same count with a unit label attached.
Counter: the same count with no total to compare against.