A progress indicator intended for terminal output (relies on ^H).
Indicator style, given as constructor argument, can be
0: percentage; 1: bar; or 2: both. Default is 0.
If using styles 1 or 2, an optional width argument
for the bar portion can also be given (default 60).
Example usage:
# First emit whatever prefaces the indicator, if desired
print " status:",
sys.__stdout__.flush()
# Create a new indicator
p = ProgressIndicator(2)
p.newIndicator()
# With each iteration through a task, or as often as you want,
# call updateProgress(), passing 2 numbers: amount completed,
# and total amount to do.
limit = 300000
for i in range(limit):
p.updateProgress(i, limit)
print
Methods
__init__(
self,
prefix,
stream=<open file '<stdout>', mode 'w' at 0x613198>)
Start a new indicator at 00%.
Optional style and width arguments are same as constructor.
Update an existing indicator to reflect given progress.
Arguments are amount completed so far, and total to do.
For example, if 4 out of 30 have been completed, call
updateProgress(4,30).