Skip to content

Instantly share code, notes, and snippets.

@kmcallister
Created July 17, 2019 21:26
Show Gist options
  • Save kmcallister/90b1a9599b2e3a308f98e5d361330c05 to your computer and use it in GitHub Desktop.
Save kmcallister/90b1a9599b2e3a308f98e5d361330c05 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import time
import sys
repeats = 12
phases = [
('Inhale', 4),
('Hold', 2),
('Exhale', 6),
('Hold', 2)
]
print()
for cycle in range(repeats):
for name, sec in phases:
total_sec = sec
while sec > 0:
print("\33[2K [cycle {:2}/{:2}] \33[1;40m{:8}\33[0m[{:<{width}}]".format(
cycle+1, repeats, name, '=' * sec, width=total_sec), end='\r', flush=True)
sec -= 1
time.sleep(1)
print("\n\nGood job! Have a relaxing day.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment