Skip to content

Instantly share code, notes, and snippets.

@milo0
Created December 3, 2017 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milo0/494148ec32647532646f73ffffaeb4bf to your computer and use it in GitHub Desktop.
Save milo0/494148ec32647532646f73ffffaeb4bf to your computer and use it in GitHub Desktop.
Spinning cursor
import itertools, sys
from time import sleep
spinner = itertools.cycle(['|', '/', '-', '\\'])
while True:
sys.stdout.write(next(spinner)) # write the next character
sys.stdout.flush() # flush stdout buffer (actual character display)
sys.stdout.write('\b') # erase the last written char
sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment