Skip to content

Instantly share code, notes, and snippets.

@brizandrew
Created August 5, 2016 19:47
Show Gist options
  • Save brizandrew/a98d15266b40f3d066e8de02a6d69795 to your computer and use it in GitHub Desktop.
Save brizandrew/a98d15266b40f3d066e8de02a6d69795 to your computer and use it in GitHub Desktop.
import sys
"""
@type dict
A dictionary containing data for the spinning line character output
@property {str} count: The amount of time, the spinner has spun
@property {List} chars: The list of characters to cycle through in order to simulate spinning
@constant
"""
spinner = {'count':0,'chars':['|','/','-','\\']}
"""
@function spinSpinner
Rotates the spinner displayed on the screen by 30 degrees
"""
def spinSpinner():
sys.stdout.write('\b')
sys.stdout.write(spinner['chars'][spinner['count']%4])
spinner['count'] += 1
sys.stdout.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment