Skip to content

Instantly share code, notes, and snippets.

@ziozzang
Last active July 25, 2016 23:02
Show Gist options
  • Save ziozzang/da78d8755d185f2ad0678713551580c9 to your computer and use it in GitHub Desktop.
Save ziozzang/da78d8755d185f2ad0678713551580c9 to your computer and use it in GitHub Desktop.
showing progress dot on python.
# 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