Skip to content

Instantly share code, notes, and snippets.

@whoo
Last active October 30, 2016 16:48
Show Gist options
  • Save whoo/2a04764d2351ca7631dfdd1daf34c3c6 to your computer and use it in GitHub Desktop.
Save whoo/2a04764d2351ca7631dfdd1daf34c3c6 to your computer and use it in GitHub Desktop.
cols=shutil.get_terminal_size((80, 20)).columns
MAX=cols-15
def pbar(cur,size):
elmt=int(cur/size*MAX)
print("\033[?25l",end="")
print("\033[0G[",end="")
print("#"*elmt,end="")
print("."*(MAX-elmt),end="")
print("] %d"%cur,end="")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment