TTYProgressBar

class sunpy.util.progressbar.TTYProgressBar(n, current=0, width=40, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source] [edit on github]

Bases: object

A simple progress bar to visualize progress on a TTY (teletypewriter). It needs to support ‘’ to delete characters.

The ProgressBar interface is start, finish, draw and poke.

Parameters:
  • n (int) – Total number of items until completion
  • current (int) – Current state of completion
  • width (int) – Width of progress bar.
  • output (file) – Teletypewriter to print on.

Attributes Summary

LEFT_BORDER
RIGHT_BORDER
SYMBOL

Methods Summary

draw() Draw current state of progress bar onto and empty bar.
finish() Finish the bar, the ProgressBar cannot be used after this method was called.
poke([n]) Increase finished items by n.
start() Draw empty bar to output.

Attributes Documentation

LEFT_BORDER = '['
RIGHT_BORDER = ']'
SYMBOL = '='

Methods Documentation

draw()[source] [edit on github]

Draw current state of progress bar onto and empty bar.

finish()[source] [edit on github]

Finish the bar, the ProgressBar cannot be used after this method was called.

poke(n=1)[source] [edit on github]

Increase finished items by n. May advance the progress bar by one or more fields.

start()[source] [edit on github]

Draw empty bar to output.