Skip to main content

Decorators for terminal-based wait animations.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

animation-0.0.7.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

animation-0.0.7-py2.py3-none-any.whl (5.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file animation-0.0.7.tar.gz.

File metadata

  • Download URL: animation-0.0.7.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for animation-0.0.7.tar.gz
Algorithm Hash digest
SHA256 764b57a5f2153378d5d8c9a8b95750b5d48249ba9ff1c09e50940d3e1c648e9f
MD5 7ef23df3666289b7ef790c2506c0b1a8
BLAKE2b-256 c93b86902d63edc1329318e40d1d13c5edf7cfed4cbf5bc2a783d55b9d856637

See more details on using hashes here.

File details

Details for the file animation-0.0.7-py2.py3-none-any.whl.

File metadata

  • Download URL: animation-0.0.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for animation-0.0.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c4210e410aac09e3632238cb6e70430cf4d8134dc2793c910a2f28275faa4cb1
MD5 fc9681f730e1866ab7080ddd2530bddf
BLAKE2b-256 d90addd459091f3c00c3dda1d3c14b15d999f15f28d95e372abee69dab280a4d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page