Skip to content

Instantly share code, notes, and snippets.

@samuelcolvin
Created March 26, 2022 11:28
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 samuelcolvin/2f0240cd809dde293b79aba1f74e2019 to your computer and use it in GitHub Desktop.
Save samuelcolvin/2f0240cd809dde293b79aba1f74e2019 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import time
clocks = ['πŸ•›', 'πŸ•', 'πŸ•‘', 'πŸ•’', 'πŸ•“', 'πŸ•”', 'πŸ••', 'πŸ•–', 'πŸ•—', 'πŸ•˜', 'πŸ•™', 'πŸ•š']
# moves the cursor to the beginning of the line
# (3 columns back in this case is always enough)
reset_cursor = '\033[3D'
i = 0
while True:
try:
clock = clocks[i % len(clocks)]
print(f'{reset_cursor}{clock} ', end='', flush=True)
i += 1
time.sleep(1 / 20)
except KeyboardInterrupt:
# print the exact time and exit
print(reset_cursor)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment