terminal_animation
A simple package to make beautiful terminal wait animations
Install
pip install terminal-animation
How to use
import animation
import time
# 1 use as class
wait_animation = animation.Wait()
wait_animation.start()
do_something()
wait_animation.end()
#2 use as decorator
@animation.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()
Release files for terminal-animation 0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| terminal_animation-0.6-py3-none-any.whl | Python 3 | none | any | Details |
Release files / terminal_animation-0.6-py3-none-any.whl
| Download URL | terminal_animation-0.6-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88d05819d7aca7b78669f011a1af399fbdc824ffcdbfee2e634c7a9bb12a25c9
|
|
BLAKE2b-256 checksum How to use checksums |
c08b32d17c86cfcc36e16b8ae6215049d9283b5657cc2a5f13dcbac710053f36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|