Little terminal spinner lib.
Project description
A little terminal spinner lib. Heavily inspired by go-spin.
Demo
Install
$ pip install pyspin
Usage
make a spinner by hand:
from __future__ import print_function
import sys
import time
from pyspin.spin import Default, Spinner
# Choose a spin style.
spin = Spinner(Default)
# Spin it now.
for i in range(50):
print(u"\r{0}".format(spin.next()), end="")
sys.stdout.flush()
time.sleep(0.1)
or you can use the decorator pyspin provide:
from __future__ import print_function
import time
from pyspin.spin import make_spin, Default
# Choose a spin style and the words when showing the spin.
@make_spin(Default, "Downloading...")
def download_video():
time.sleep(10)
if __name__ == '__main__':
print("I'm going to download a video, and it'll cost much time.")
download_video()
print("Done!")
You can have a look at the example code in the example folder. Run it via:
$ python example/example_spin.py $ python example/usage_example.py
Contribute
If you find an interesting spinner, send me a pull request <3
If you find a bug or have any suggestions, open an issue.
Contributions are always welcome at any time! :sparkles: :cake: :sparkles:
License
MIT.
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
pyspin-1.0.1.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for pyspin-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aae0fd11f14c436b12333f0dd3e1416e6b688975c5e0452a8e65dcf641b0e378 |
|
MD5 | cc652f99ca286200917bb36c06da101c |
|
BLAKE2b-256 | 204b3c229754b588b3da17cd16ec51426f5599d8b766dca0b96c47b26803fe16 |