-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
45 lines (40 loc) · 1.37 KB
/
main.py
File metadata and controls
45 lines (40 loc) · 1.37 KB
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
import PySimpleGUI as sg
sg.theme("BluePurple")
font1 = "Arial, 60"
font2 = "Hack, 60"
font3 = "Hack, 10"
layout = [
[
sg.Text(
"Welcome to Python Timer",
font=font3,
text_color="black",
justification="center",
)
],
[
sg.InputText(size=(2, 2), font=font1, key="-HOURS-", pad=(32, 32)),
sg.Text(":", font=font2, text_color="black"),
sg.InputText(size=(2, 2), font=font1, key="-MINUTES-", pad=(32, 32)),
sg.Text(":", font=font2, text_color="black"),
sg.InputText(size=(2, 2), font=font1, key="-SECONDS-", pad=(32, 32)),
],
[sg.Text("", key="-OUTPUT-")],
[
sg.Button("Start", size=(5, 4), border_width=3, pad=(32, 20)),
sg.Button("Stop", size=(5, 4), border_width=3, pad=(32, 20)),
sg.Button("Reset", size=(5, 4), border_width=3, pad=(35, 20)),
sg.Button("Exit", size=(5, 4), border_width=3, pad=(32, 20)),
],
]
window = sg.Window("Python Timer", layout)
while True:
event, values = window.read()
if event == "Start":
hours = values["-HOURS-"]
minutes = values["-MINUTES-"]
seconds = values["-SECONDS-"]
window["-OUTPUT-"].update(f"{hours}:{minutes}:{seconds}")
# print(int(hours)+1, int(minutes)+60, int(seconds)+60)
if event == sg.WIN_CLOSED or event == "Exit":
window.close()