memilio.epidata.progress_indicator
Classes
|
Subclass of ProgressIndicator with a predefined animation. |
|
Subclass of ProgressIndicator with a predefined animation. |
|
Print an animation to show that something is happening. Animations are rendered in a new thread, which is set up as deamon so that it stops on main thread exit. The subclasses Dots, Spinner and Percentage provide some default animations. Start the animation by either using the start/stop functions or a 'with as' block, e.g |
|
Subclass of ProgressIndicator with a predefined animation. |
- class memilio.epidata.progress_indicator.Dots(
- delay=1,
- message='',
- num_dots=3,
- dot='.',
- blank=' ',
Subclass of ProgressIndicator with a predefined animation.
- class memilio.epidata.progress_indicator.Percentage(
- delay=1,
- message='',
- percentage=0,
- use_bar=True,
- keep_output=False,
Subclass of ProgressIndicator with a predefined animation.
- set_progress(percentage)
Updates the percentage shown by the indicator. Steps if delay = 0.
- Parameters:
percentage – real number. Must be in the interval [0, 1].
- start()
Start the animation. Must call stop() afterwards. If delay > 0, this method spawns a new thread.
- stop()
Stops the animation.
- class memilio.epidata.progress_indicator.ProgressIndicator(
- message,
- animator,
- delay,
- auto_adjust=False,
Print an animation to show that something is happening. Animations are rendered in a new thread, which is set up as deamon so that it stops on main thread exit. The subclasses Dots, Spinner and Percentage provide some default animations. Start the animation by either using the start/stop functions or a ‘with as’ block, e.g ``` with ProgressIndicator.Spinner():
do_something…
or
- with ProgressIndicator.Percentage() as indicator:
- for i in range(n):
do_something… indicator.set_progress((i+1)/n)
- static disable_indicators(
- disable,
Globally prevents new indicators from starting. This does not affect currently running indicators.
- Parameters:
disable – Bool. If True, no new indicators can be started. If False, resume default behaviour.
- set_message(message)
Change the message displayed in front of the animation.
- param message:
String. Shown in front of the animation without seperator. If it would not fit in a single line with the animation, it will be printed once in a new line above the animation instead. Must not contain `
` or ` `.
- show()
Print the animation without advancing it.
- start()
Start the animation in a new thread. Must call stop afterwards.
- step()
Advance and print the animation.
- stop()
Stop the animation and join the thread.
- class memilio.epidata.progress_indicator.Spinner(delay=0.1, message='')
Subclass of ProgressIndicator with a predefined animation.