pyworkflow.utils.progressbar module
- class pyworkflow.utils.progressbar.ProgressBar(total, width=40, fmt='Progress: %(bar)s %(percent)3d%%', symbol='=', output=None, extraArgs=None, step=10000)[source]
Bases:
object
Text progress bar class for Python.
A text progress bar is typically used to display the progress of a long-running operation, providing a visual cue that processing is underway.
Example:
N = 1000 pb = ProgressBar(N, fmt=ProgressBar.FULL) pb.start() for x in range(N): pb.update(x+1) sleep(0.1) pb.finish()
Optionally you can pass a step param (default to 10000) and call increase in each loop. Only when the step is reached, the progress is printed.
Create a new ProgressBar object.
- Parameters
total – The total amount that will be running the progress bar. The value in the update() method can no go greater than this value.
width – progress bar width (without the percentage and number of iterations loop)
fmt – predefined format string, so far DEFAULT, FULL, OBJID and DOT are defined.
symbol – progress bar is made with this symbol
output –
extraArgs – Additional arguments that can be passed to be used the fmt format. (e.g extraArgs={‘objectId’: 1} for fmt=OBJID
step – interval between printing progress. Use in combination with “increase”
- DEFAULT = 'Progress: %(bar)s %(percent)3d%%'
- DOT = '.'
- FULL = '%(bar)s %(current)d/%(total)d (%(percent)3d%%) %(remaining)d to go'
- NOBAR = '%(current)d/%(total)d (%(percent)3d%%) %(remaining)d to go'
- OBJID = '%(bar)s %(current)d/%(total)d (%(percent)3d%%) (objectId=%(objectId)d)'