Skip to content

Instantly share code, notes, and snippets.

@zeffii
Last active August 29, 2015 14:17
Show Gist options
  • Save zeffii/e69990047b89707c3461 to your computer and use it in GitHub Desktop.
Save zeffii/e69990047b89707c3461 to your computer and use it in GitHub Desktop.
progress bar
# gleaned from http://stackoverflow.com/a/3160819/1243487
import sys, time
def make_progressbar(toolbar_width):
fspace = "-" * toolbar_width
sys.stdout.write("[" + fspace + "]")
sys.stdout.flush()
sys.stdout.write("\b" * (toolbar_width + 1))
for i in fspace:
time.sleep(0.1)
sys.stdout.write("|")
sys.stdout.flush()
sys.stdout.write("\n")
make_progressbar(44)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment