-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
78 lines (59 loc) · 3.06 KB
/
main.py
File metadata and controls
78 lines (59 loc) · 3.06 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
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
from tkinter import *
import db_conn
from Frames import athlete_frame, registration_frame, course_frame
from db_conn import query
class Mainclass: # DPI = Inhalt wird automatisch an den aktuellen DPI angepasst (getestet mit Linux in 4k)
def __init__(self):
if __name__ == '__main__':
self.frame_list = {}
query()
self.app = Tk()
self.app.title("Business Analytics Exercise 1")
w = round(self.app.winfo_screenwidth() * 0.20416667) # relative Breite
h = round(self.app.winfo_screenheight() * 0.30) # relative Höhe
w1 = round(self.app.winfo_screenwidth() * 0.10)
h1 = round(self.app.winfo_screenheight() * 0.20)
self.app.geometry(f"{w}x{h}")
self.app.minsize(500, 500)
self.app.maxsize(1000,1000)
self.app.resizable(True, True)
self.add_menu()
self.label_text = Label(self.app, text="Welcome", font=("Calibri", 25))
self.label_text.pack(pady=200)
self.app.mainloop()
def open_athlete_frame(self):
if not self.frame_list:
self.label_text.destroy() # Beendet das ursprüngliche Label. Kann öfter mals ausgeführt werden ohne fehler
self.frame_list["cdf"] = athlete_frame.Window(self.app)
elif "cdf" not in self.frame_list:
self.destroy()
self.open_athlete_frame()
def open_registration_frame(self):
if not self.frame_list: # Abfrage ob dictionary leer ist
self.label_text.destroy()
self.frame_list["ref"] = registration_frame.Registration(self.app)
elif "ref" not in self.frame_list:
self.destroy()
self.open_registration_frame()
def open_course_frame(self):
if not self.frame_list:
self.label_text.destroy()
self.frame_list["cof"] = course_frame.Course(self.app)
elif "cof" not in self.frame_list:
self.destroy()
self.open_course_frame()
def add_menu(self):
# Menu Bar erstellen und hinzufügen
menu = Menu(self.app)
self.app.config(menu=menu)
filemenu = Menu(menu, tearoff=0, relief='flat', bd=0,activebackground='#030ffc', activeborderwidth=0,font=("Calibri", 12))
menu.add_cascade(label="Operation", menu=filemenu, font=("Calibri", 12))
filemenu.add_command(label="Athlete", command=self.open_athlete_frame)
filemenu.add_command(label="Course", command=self.open_course_frame)
filemenu.add_command(label="Registration", command=self.open_registration_frame)
def destroy(self):
for item in self.frame_list:
self.frame_list[item].self_destruct()
del self.frame_list[item]
break
main = Mainclass()