Created
August 22, 2020 18:44
-
-
Save krstp/2dd73595417ad7fc7cde7fa8e54f556e to your computer and use it in GitHub Desktop.
Rotating ASCII command line loader cursor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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