Skip to content

Instantly share code, notes, and snippets.

@krstp
Created August 22, 2020 18:44
Show Gist options
  • Save krstp/2dd73595417ad7fc7cde7fa8e54f556e to your computer and use it in GitHub Desktop.
Save krstp/2dd73595417ad7fc7cde7fa8e54f556e to your computer and use it in GitHub Desktop.
Rotating ASCII command line loader cursor
import sys
import time
def spinning_cursor():
while True:
for cursor in '|/-\\':
yield cursor
spinner = spinning_cursor()
for _ in range(50):
sys.stdout.write(next(spinner))
sys.stdout.flush()
time.sleep(0.1)
sys.stdout.write('\b')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment