4Suite™ API Documentation

# ► Module Ft.Lib.ProgressIndicator

Progress indicator
Copyright 2004 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/

Classes: AutoProgressIndicator, ProgressIndicator

## Classes

class AutoProgressIndicator(ProgressIndicator)

### Methods

__init__(self, prefix, total, step=1, stream=<open file '<stdout>', mode 'w' at 0x8216068>)
advance(self)

### Methods inherited from class ProgressIndicator

message, newIndicator, updateProgress

class ProgressIndicator
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 0x8216068>)
message(self, message)
newIndicator(self, total)
Start a new indicator at 00%. Optional style and width arguments are same as constructor.
updateProgress(self, cur)
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).