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.2.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file pyspin-1.0.2.tar.gz
.
File metadata
- Download URL: pyspin-1.0.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e3228f17ecc3727dce42ce670c4dec340c822ca414b11e6d2ba6497e4bbb7b7 |
|
MD5 | 9073af3f8705bbf72e43c691206f0d34 |
|
BLAKE2b-256 | 8620a089d4a3969554d6215884ddd263a2376ca5f77d60cdc3e1cbf6a4c3fe82 |
File details
Details for the file pyspin-1.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: pyspin-1.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a38e26cd33b8a6bd1c4f66843c34a31b78cc8cd8b917984a39d01cde5848985 |
|
MD5 | 3677f03216cfc6bf62559bea84cfc08d |
|
BLAKE2b-256 | 4a9557231bfd07bea89a07ae2d62b62b8b85fd1c6d191c9ee68477009ca81b29 |