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! ✨ 🍰 ✨
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.1.1.tar.gz
(4.1 kB
view details)
Built Distribution
File details
Details for the file pyspin-1.1.1.tar.gz
.
File metadata
- Download URL: pyspin-1.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3fedd8bf860b308d860fe6191fc4fdf76eaf07c8963729a8dd767e7f7694f65 |
|
MD5 | c493b068c99d1a7aa784fdcc22be7086 |
|
BLAKE2b-256 | 91cba15ec0cb235a5f6581953c75f60e5784cb644dba2b588928e57be2a3b7b4 |
File details
Details for the file pyspin-1.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: pyspin-1.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe6c70cdb656b6acf5b61aa93189656569e01c982cd2854b04faf0abc1048a03 |
|
MD5 | 87d8a748f32f7d308e9adca98a8fd95c |
|
BLAKE2b-256 | 879d060bb843fd1394407fad31bb222f91517966ba6f76cc760475f1adc2034d |