Created
January 5, 2020 20:10
-
-
Save benstigsen/0c575f79c950a2557a8358ad11f963e0 to your computer and use it in GitHub Desktop.
Revisions
-
Benjamin Stigsen revised this gist
Jan 5, 2020 . No changes.There are no files selected for viewing
-
Benjamin Stigsen created this gist
Jan 5, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ import time, winsound, os def clear(): os.system("cls||clear") def playTone(frequency, duration, repeat): for _ in range(repeat): winsound.Beep(frequency, duration) def work(duration = 1200, text = "-"): playTone(1300, 100, 2) for (i) in range(10): clear() print(f"Work | {text} | {((duration / 10) * (10 - i)) / 60} minutes\n") time.sleep(duration / 10) def pause(duration = 300, text = "-"): playTone(1000, 150, 3) for (i) in range(10): clear() print(f"Break | ({text}) | {((duration / 10) * (10 - i)) / 60} minutes\n") time.sleep(duration / 10) def start(rounds, work_duration, break_duration): while True: for (i) in range(rounds): work(duration = work_duration, text = f"{i + 1}/{rounds}") if (i == rounds - 1): # Long Break (5x short break duration) pause(break_duration * 5) else: # Regular Break pause(duration = break_duration, text = f"{i + 1}/{rounds}") start(4, 1200, 300)