-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.py
More file actions
45 lines (33 loc) · 942 Bytes
/
function.py
File metadata and controls
45 lines (33 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from pygame import mixer
import pyfiglet
from pathlib import Path
import json
import os
import time as tm
import JSONconfig
def play_sound():
ROOT_FILE = Path(__file__).parent
SOUNDFILE_PATH = ROOT_FILE / "erro.mp3"
mixer.init()
mixer.music.load(SOUNDFILE_PATH)
mixer.music.play()
def chronoTimer():
with open(JSONconfig.JSON_FILE,"r") as arquivo:
data = json.load(arquivo)
for i in data["Sequence"]:
os.system('clear')
time = data[i] * 60
while time >= 0:
os.system('clear')
min,sec = divmod(time,60)
print(pyfiglet.figlet_format(f"{min:02} : {sec:02}", font= "computer"))
tm.sleep(1)
time -= 1
play_sound()
option = input("Do you want to continue ? (Y/n)")
if option == "Y" or "y":
pass
else:
break
if __file__ == "__main__":
chronoTimer()