A class to display a progress bar in the terminal.
It is designed to be used with the with statement:
with ProgressBar(len(items)) as bar:
for item in enumerate(items):
bar.update()
Methods Summary
map(function, items[, multiprocess, file]) | Does a map operation while displaying a progress bar with percentage complete. |
update([value]) | Update the progress bar to the given value (out of the total given to the constructor. |
iterate(items[, file]) | Iterate over a sequence while indicating progress with a progress bar in the terminal. |
Methods Documentation
Does a map operation while displaying a progress bar with percentage complete.
def work(i):
print(i)
ProgressBar.map(work, range(50))
Parameters : | function : function
items : sequence
multiprocess : bool, optional
file : writeable file-like object, optional
|
---|
Update the progress bar to the given value (out of the total given to the constructor.
Iterate over a sequence while indicating progress with a progress bar in the terminal.
for item in ProgressBar.iterate(items):
pass
Parameters : | items : sequence
file : writeable file-like object, optional
|
---|---|
Returns : | generator : :
|