himalaya.progress_bar.ProgressBar¶
- class himalaya.progress_bar.ProgressBar(title='', max_value=None, initial_value=0, max_chars=40, progress_character='.', spinner=False, verbose_bool=True)[source]¶
Generate a command-line progress bar.
- Parameters
- max_valueint
Maximum value of process (e.g. number of samples to process, bytes to download, etc.).
- initial_valueint
Initial value of process, useful when resuming process from a specific value, defaults to 0.
- titlestr
Message to include at end of progress bar.
- max_charsint
Number of characters to use for progress bar (be sure to save some room for the message and % complete as well).
- progress_characterchar
Character in the progress bar that indicates the portion completed.
- spinnerbool
Show a spinner. Useful for long-running processes that may not increment the progress bar very often. This provides the user with feedback that the progress has not stalled.
Examples
>>> import time >>> from himalaya.progress_bar import ProgressBar >>> for ii in ProgressBar(title="La barre", max_value=10)(range(10)): >>> time.sleep(0.5)
Methods
__call__
(sequence)Call self as a function.
close
()Close the progress bar.
update
(cur_value[, title])Update progressbar with current value of process.
update_with_increment_value
(increment_value)Update progressbar with the value of the increment instead of the current value of process as in update().