Skip to content

Instantly share code, notes, and snippets.

@lazybios
Created February 27, 2015 03:11
Show Gist options
  • Save lazybios/4aea1180286ddf362e6b to your computer and use it in GitHub Desktop.
Save lazybios/4aea1180286ddf362e6b to your computer and use it in GitHub Desktop.
text loading
spinsize = 10
spinpos = 0
spindir = 1
def spin():
global spinsize,spinpos,spindir
spinstr = '.'*spinpos + \
'|' + '.'* (spinsize - spinpos -1)
sys.stdout.write('\r'+spinstr+' ')
sys.stdout.flush()
spinpos += spindir
if spinpos < 0:
spindir = 1
spinpos = 1
elif spinpos >= spinsize:
spinpos -= 2
spindir = -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment