-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.py
66 lines (45 loc) · 1.36 KB
/
gui.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import tkinter as tk
import main
bgCol = "#4B064B"
# Main Window
win = tk.Tk()
win.geometry('400x180')
win.title("Covid Tracker")
win.configure(bg=bgCol)
# Header
headerFrame = tk.Frame(win)
headerFrame.pack(fill=tk.X)
headText = tk.Label(headerFrame)
headText.configure(text='COVID TRACKER')
headText.pack()
# Input
inpFrame = tk.Frame(win)
inpFrame.configure(bg=bgCol)
inpFrame.pack(pady=20,fill=tk.X)
inpEntry = tk.Entry(inpFrame)
inpEntry.configure(width=40)
inpEntry.pack(pady=10)
stateHead = tk.Label(win,text='')
def onClick():
inpFrame.pack(side='bottom')
win.geometry('800x800')
userInput = inpEntry.get()
stateData = main.mainCall(userInput)
stateHead.configure(text=stateData['state'])
stateHead.configure(font=('Helvetica',20))
stateHead.place(x=20,y=20)
dataFrame = tk.Frame(win)
dataFrame.configure(width=1200,height=600,bg=bgCol)
dataFrame.place(x=10,y=80)
i = 0
for key in stateData:
keyLabel = tk.Label(dataFrame,text=key.upper(),bg=bgCol,fg='white')
keyLabel.place(x=20,y=50 + i)
valLabel = tk.Label(dataFrame,text=stateData[key],bg=bgCol,fg='white')
valLabel.place(x=200,y=50 + i)
i = i + 40
#Button
trackButton = tk.Button(inpFrame,text="Track",width=20)
trackButton.pack(pady=20,side='bottom')
trackButton.configure(command=onClick)
win.mainloop()