Skip to content

Instantly share code, notes, and snippets.

@rcbop
Created February 9, 2023 17:25
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 rcbop/87cd5df25ff1b88ef995ad1bf932aef5 to your computer and use it in GitHub Desktop.
Save rcbop/87cd5df25ff1b88ef995ad1bf932aef5 to your computer and use it in GitHub Desktop.
from tqdm import trange
from time import sleep
from random import choice
POMODORO_IN_MILLIS = 1000 * 60 * 25
colors = ["red", "green", "blue", "yellow", "magenta", "cyan", "white"]
pomodoros = 0
while pomodoros < 4:
if pomodoros != 0:
print("Pomodoro completed!")
print("Take a break! (5 minutes")
input("press a any key to start a pomodoro")
with trange(POMODORO_IN_MILLIS, ncols=150, bar_format='{desc}\t{bar}\t{postfix}') as t:
for i in t:
sleep(0.001)
t.update()
t.set_postfix_str(f"Pomodoros [{pomodoros}/4]")
if i % 60000 == 0:
t.colour = choice(colors)
t.set_description_str("Timer {:02d}:{:02d}".format(i // 1000 // 60, i // 1000))
pomodoros += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment