Registrations with limited permissions are open. Reach out if you want to host your code here.
Simple pomodoro timer for linux / cli with text output
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

40 lines
741 B

#!/usr/bin/env python3
import os
import time
# Duration in minutes
work_time = 1
break_time = 1
# Duration in Seconds
work_time_sec = work_time * 60
break_time_sec = break_time * 60
def sec_to_min(sec):
full_min = int(sec / 60)
rest = sec - full_min * 60
output = str(full_min)+':'+str(rest).zfill(2)
return output
def timer(text,sec):
while sec > 0:
f = open('countdown.txt', 'w')
output = text + " " + sec_to_min(sec)
f.write(str(output))
f.close()
sec -= 1
time.sleep(1)
#os.system('cls' if os.name == 'nt' else 'clear')
print(chr(27) + "[2J") # only tested on Linux
print(output)
def main():
while True:
timer('Work',work_time_sec)
timer('Break',break_time_sec)
if __name__ == "__main__":
main()