Created
February 9, 2023 17:25
-
-
Save rcbop/87cd5df25ff1b88ef995ad1bf932aef5 to your computer and use it in GitHub Desktop.
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
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