Skip to main content

Decorators for terminal-based wait animations.

Project description

terminal_animation

A simple package to make beautiful terminal wait animations

Install

pip install terminal-animation

How to use

import animations
import time

# 1 use as class
wait_animation = animations.Wait()
wait_animation.start()
do_something()
wait_animation.end()

#2 use as decorator
@animations.wait()
def do_something_else():
    # long function
    time.sleep(5)

Customization

The package uses a default animation with dots. It allows users to customize the the animation with different parameters.

The default settings are:

color: white
speed: 0.2
animation = ['    ','.   ','..  ','... ','....']

Color

The color of the characters. Available options are:

  • black ...
  • red ...
  • green ...
  • yellow ...
  • blue ...
  • magenta ...
  • cyan ...
  • white ...

Speed

The speed between, the animation states.

0 < speed < 1

Animation

To use a custom animation, you have to pass a string array containing the seperate steps of the animation. For example, a simple clock animation would look like this

clock = ['-','\\','|','/']

@animation.wait(clock)
def do_something():
    # long function

Examples

# default animation (white, dots, default speed)
@animation.wait()
def default():
    time.sleep(10)

# clock animation (white, default speed)
clock = ['-','\\','|','/']

@animation.wait(clock)
def do_something():
    time.sleep(10)


# horizontal line animation (blue, default speed)
lines = ['   ','-  ','-- ','---']

@animation.wait(lines, color="blue")
def do_something_else():
    time.sleep(10)


# hashtag animation (cyan, slow)
tags = ["#   ", "##  ", "### ", "####"]

animation = animations.Wait(tags, color="blue", speed=0.5)
animation.start()
time.sleep(4)
animation.stop()

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

terminal_animation-0.4-py2-none-any.whl (4.2 kB view details)

Uploaded Python 2

File details

Details for the file terminal_animation-0.4-py2-none-any.whl.

File metadata

  • Download URL: terminal_animation-0.4-py2-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.2

File hashes

Hashes for terminal_animation-0.4-py2-none-any.whl
Algorithm Hash digest
SHA256 7aabaa6715aeb85fdf870bfe3e51bbacc4f705284e3abc250af367f7adc1b9d8
MD5 b13b3085511bdb53ff3170054c96106a
BLAKE2b-256 f28795a7b142de2790b0979b9c8e8a0ea7cc735cad5a0ae5da7a9a0759da7d7d

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