Parameters: |
|
---|
Deletes anything rendered by the bar. This may be called after the long-running task has finished to remove the bar from the screen. This must be called before attemping to write anything new to the prompt.
Wraps an iterator to automatically make the appropriate calls into the progress bar on each iteration. The supplied message_func can be used to derive a message for each step in the iteration. For example:
it = pb.iterator(items, message_func=lambda x : 'Generated message: %s' % x)
for i in it:
# do stuff
Parameters: |
|
---|---|
Returns: | iterator that will draw contents from the supplied iterator and automatically update the progress bar |
Return type: | iterator |
Renders the progress bar. The percentage filled will be calculated using the step and total parameters (step / total).
If message is provided, it will be displayed below the progress bar. The message will be deleted on the next call to update and can be used to provide more information on the current step being rendered.
Parameters: |
|
---|
Deletes anything rendered by the spinner. This may be called after the long-running task has finished to remove the spinner from the screen. This must be called before attemping to write anything new to the prompt.
Wraps an iterator to automatically render the next step in the spinner sequence at each pass through it.
Parameters: | iterable (iterator) – iterator to wrap |
---|---|
Returns: | iterator that will draw contents from the supplied iterator and automatically update the progress bar |
Return type: | iterator |
Renders the next image in the spinner sequence.
Parameters: |
|
---|
Renders a spinner in a separate thread at a regular interval. This is useful in cases where each step in the actual code executing while the spinner is running takes a variable amount of time; this will mask those differences from the user and result in a smooth spin.
Once instantiated, the start() method is used to begin the rendering. Each step is rendered at a rate specified in refresh_seconds in the constructor. The spinner will continue to render until stop() is called. Callers should be careful to not use the prompt instance while the spinner is running.
Due to its behavior, the iterator() method in the Spinner base class is not supported.
Parameters: |
|
---|
Causes the spinner to begin rendering steps. The rendering will be done through the prompt supplied in the constructor however it will be done in a separate thread. This call will immediately return and the spinning will begin.
Callers should be careful to call stop() before attempting to use the prompt again. Bad things would happen if the spinner thread continued to attempt to update while other content was written to the prompt.
If the spinner is already running from a previous call to start(), this call has no effect.
Causes the spinner to stop spinning. The thread is not immediately killed but instead allowed to trigger one more step in the sequence. This call will block until that step has been rendered. This shouldn’t be noticable except in cases of a very high value for refresh_seconds.