Last active
July 25, 2016 23:02
-
-
Save ziozzang/da78d8755d185f2ad0678713551580c9 to your computer and use it in GitHub Desktop.
showing progress dot on python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code by Jioh L. Jung ([email protected]) | |
import time, sys | |
dot = [ # from https://github.com/heroku/heroku-cli-util/blob/master/lib/spinners.json | |
"⠋", | |
"⠙", | |
"⠹", | |
"⠸", | |
"⠼", | |
"⠴", | |
"⠦", | |
"⠧", | |
"⠇", | |
"⠏" | |
] | |
interval = 0.3 #sec | |
pos = 0 | |
while True: | |
print dot[pos] | |
pos = (pos+1) % len(dot) | |
time.sleep(interval) | |
sys.stdout.write("\033[F") # Cursor up one line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment