Skip to main content

Tools for terminal-based wait animations

Installation

git clone http://github.com/bprinty/animation.git
cd animation
python setup.py install

Documentation

Documentation for the package can be found at Read The Docs.

Usage

The animation module provides decorators for doing terminal-based wait animations. To add a wait animation to a function that requires some processing time, simply decorate the function with the wait animation you want to use.

Here is an example of how to use it in a project:

import animation
import time

@animation.simple_wait
def long_running_function():
    ... 5 seconds later ...
    return

This will print an animated waiting message like this (the elipses at the end of the text grow and shrink while the function executes):

waiting ...

The animation types provided by default are:

  • bar (simple bar that slides back and forth)

  • spinner (a spinning line)

  • dots (dots that move around in a sqare)

  • elipses (elipses that grow and shrink)

  • text with elipses (elipses with text in front of them)

And you can use any of these built-in animations like so:

import animation
import time

@animation.wait('bar')
def long_running_function():
    ... 5 seconds later ...
    return

@animation.wait('spinner')
def long_running_function():
    ... 5 seconds later ...
    return

In addition to these default types, the module also supports custom animations. For example, to create an animation with a counter-clockwise spinning wheel:

wheel = ('-', '/', '|', '\\')
@animation.wait(wheel)
def long_running_function():
    ... 5 seconds later ...
    return

If you want to manually start and stop the wait animation, you can use the `animation.Wait` class:

wait = animation.Wait()
wait.start()
long_running_function()
wait.stop()

Finally, you can change the color of animations with the `color=` argument:

import animation

@animation.wait('bar', color='blue')
def long_running_function():
    ... 5 seconds later ...
    return

Questions/Feedback

File an issue in the GitHub issue tracker.

Metadata

Release files for animation 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for animation 0.0.7
File Size Uploaded
animation-0.0.7.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for animation 0.0.7
File Interpreter ABI Platform
animation-0.0.7-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 12.0 kB

Release files / animation-0.0.7.tar.gz

Download URL animation-0.0.7.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
764b57a5f2153378d5d8c9a8b95750b5d48249ba9ff1c09e50940d3e1c648e9f
BLAKE2b-256 checksum
How to use checksums
c93b86902d63edc1329318e40d1d13c5edf7cfed4cbf5bc2a783d55b9d856637
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1

Release files / animation-0.0.7-py2.py3-none-any.whl

Download URL animation-0.0.7-py2.py3-none-any.whl
Size 5.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c4210e410aac09e3632238cb6e70430cf4d8134dc2793c910a2f28275faa4cb1
BLAKE2b-256 checksum
How to use checksums
d90addd459091f3c00c3dda1d3c14b15d999f15f28d95e372abee69dab280a4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page