This repository has been archived by the owner on Dec 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgui.py
79 lines (61 loc) · 2.42 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
67
68
69
70
71
72
73
74
75
76
77
78
79
import tkinter
import api
import gui
import config
import wallpaper
from tkinter import ttk
from tkinter import Label, Menu, LEFT, StringVar, Toplevel
from tkinter.messagebox import showinfo
from PIL import ImageTk, Image
w = tkinter.Tk()
menubar = Menu(w)
filemenu = Menu(menubar, tearoff=0)
filemenu.add_command(label="Exit", command=w.quit)
menubar.add_cascade(label="File", menu=filemenu)
def about():
top = Toplevel(bg = '#081421')
img = ImageTk.PhotoImage(Image.open(config.resource_path("img/mark.png")))
img_panel = Label(top, image = img, bg = '#081421')
img_panel.pack(pady=10)
description = Label(top, text="Made to have an easy way to track\n coronavirus cases in your area", fg="white", bg="#081421")
description.pack(expand="no")
size = 15, 15
# Website Social
adress = Label(top, text="You can find me at https://maurom.dev/", fg="white", bg="#081421" )
adress.pack()
# Github Social
github = ImageTk.PhotoImage(Image.open(config.resource_path("img/github.png")).resize(size))
g_icon = Label(top, image=github, bg="#081421")
at = Label(top, text="@MM-coder", fg="white", bg="#081421" )
g_icon.pack(side=LEFT, padx=10)
at.pack(side=LEFT)
top.title("About")
top.geometry("320x200")
top.mainloop()
helpmenu = Menu(menubar, tearoff=0)
helpmenu.add_command(label="About", command=about)
menubar.add_cascade(label="Help", menu=helpmenu)
current_var = StringVar(w)
current_var.set(f"Your current country is {config.load_option_from_config('country')}")
current = ttk.Label(w, textvariable=current_var)
current.pack()
country = StringVar(w)
country.set("World") # initial value
country_list = api.get_country_list()
option = ttk.Combobox(w, values=country_list)
option.current(country_list.index(config.load_option_from_config('country')))
option.pack(padx=10, pady=10)
def confirm():
config.write_option_to_config('country', option.get())
current_var.set(f"Your current country is {config.load_option_from_config('country')}")
confirm = ttk.Button(w, text="Change Country", command=confirm)
confirm.pack(padx=20)
def force_update():
wallpaper.generate_wallpaper_and_set()
showinfo("Action Complete", "Wallpaper has been set!")
confirm = ttk.Button(w, text="Set Wallpaper", command=force_update)
confirm.pack(padx=20)
w.title("Coronavirus Wallpaper")
w.iconbitmap(default=config.resource_path('img/virus.ico'))
w.config(menu=menubar)
w.geometry("320x200")