diff --git a/Programm/main.py b/Programm/main.py index 58ddbfe..3fc650c 100644 --- a/Programm/main.py +++ b/Programm/main.py @@ -1,9 +1,11 @@ from customtkinter import * +from CTkTable import * from PIL import Image # Links # - Icons: https://www.flaticon.com # - CustomTkinter: https://customtkinter.tomschimansky.com/ +# - CTkTable: https://github.com/Akascape/CTkTable # Referenzen # - Vorlage: https://github.com/RoyChng/customtkinter-examples/tree/master/Inventory%20Management @@ -70,27 +72,27 @@ class Main_Window(CTk): self.img_dashboard = CTkImage(dark_image=self.img[1], light_image=self.img[1]) self.img_dashboard_red = CTkImage(dark_image=self.img_red[0], light_image=self.img_red[0]) - self.button1 = CTkButton(master=self.sidebar_frame, image=self.img_dashboard, text="Dashboard", fg_color="transparent", font=("Arial Bold", 14), hover_color=contrastColor, anchor="w", command=lambda: self.initiate_window(1)) + self.button1 = CTkButton(master=self.sidebar_frame, image=self.img_dashboard, text="Dashboard", text_color="#fff", fg_color="transparent", font=("Arial Bold", 14), hover_color=contrastColor, anchor="w", command=lambda: self.initiate_window(1)) self.button1.pack(padx=5, pady=5) self.img_edit = CTkImage(dark_image=self.img[2], light_image=self.img[2]) self.img_edit_red = CTkImage(dark_image=self.img_red[1], light_image=self.img_red[1]) - self.button2 = CTkButton(master=self.sidebar_frame, image=self.img_edit, text="Eintragen", fg_color="transparent", font=("Arial Bold", 14), hover_color=contrastColor, anchor="w", command=lambda: self.initiate_window(2)) + self.button2 = CTkButton(master=self.sidebar_frame, image=self.img_edit, text="Eintragen", text_color="#fff", fg_color="transparent", font=("Arial Bold", 14), hover_color=contrastColor, anchor="w", command=lambda: self.initiate_window(2)) self.button2.pack(padx=5, pady=5) self.img_table = CTkImage(dark_image=self.img[3], light_image=self.img[3]) self.img_table_red = CTkImage(dark_image=self.img_red[2], light_image=self.img_red[2]) - self.button3 = CTkButton(master=self.sidebar_frame, image=self.img_table, text="Werte", fg_color="transparent", font=("Arial Bold", 14), hover_color=contrastColor, anchor="w", command=lambda: self.initiate_window(3)) + self.button3 = CTkButton(master=self.sidebar_frame, image=self.img_table, text="Werte", text_color="#fff", fg_color="transparent", font=("Arial Bold", 14), hover_color=contrastColor, anchor="w", command=lambda: self.initiate_window(3)) self.button3.pack(padx=5, pady=5) self.img_users = CTkImage(dark_image=self.img[4], light_image=self.img[4]) self.img_users_red = CTkImage(dark_image=self.img_red[3], light_image=self.img_red[3]) - self.button4 = CTkButton(master=self.sidebar_frame, image=self.img_users, text="Sportler", fg_color="transparent", font=("Arial Bold", 14), hover_color=contrastColor, anchor="w", command=lambda: self.initiate_window(4)) + self.button4 = CTkButton(master=self.sidebar_frame, image=self.img_users, text="Sportler", text_color="#fff", fg_color="transparent", font=("Arial Bold", 14), hover_color=contrastColor, anchor="w", command=lambda: self.initiate_window(4)) self.button4.pack(padx=5, pady=5) self.img_settings = CTkImage(dark_image=self.img[5], light_image=self.img[5]) - self.button5 = CTkButton(master=self.sidebar_frame, image=self.img_settings, text="Einstellungen", fg_color="transparent", font=("Arial Bold", 14), hover_color=contrastColor, anchor="w", command=self.open_window_settings) + self.button5 = CTkButton(master=self.sidebar_frame, image=self.img_settings, text="Einstellungen", text_color="#fff", fg_color="transparent", font=("Arial Bold", 14), hover_color=contrastColor, anchor="w", command=self.open_window_settings) self.button5.pack(padx=10, pady=10,side=BOTTOM) self.window_settings = None @@ -100,7 +102,7 @@ class Main_Window(CTk): self.lastWindow = None self.lastButton = None - self.initiate_window(1) + self.initiate_window(3) def initiate_window(self,windowNumber): if(windowNumber!=self.lastWindow): @@ -128,23 +130,31 @@ class Main_Window(CTk): buttons[self.lastButton-1].configure(fg_color="transparent", hover_color=contrastColor, text_color="#fff",image=img[self.lastButton-1]) self.lastButton = buttonNumber - def window_1(self): + def window_1(self): # Dashboard self.buttonTest = CTkButton(master=self.main_container, text="Dashboard", fg_color=contrastColor, font=("Arial Bold", 14), hover_color=mainColor, anchor="center") self.buttonTest.pack(padx=5, pady=5,expand=True) - def window_2(self): + def window_2(self): # Eintragen self.buttonTest = CTkButton(master=self.main_container, text="Eintragen", fg_color=contrastColor, font=("Arial Bold", 14), hover_color=mainColor, anchor="center") self.buttonTest.pack(padx=5, pady=5,expand=True) - def window_3(self): - self.buttonTest = CTkButton(master=self.main_container, text="Werte", fg_color=contrastColor, font=("Arial Bold", 14), hover_color=mainColor, anchor="center") + def window_3(self): # Werte + self.scrollable_frame = CTkScrollableFrame(self.main_container, label_text="Werte") + self.scrollable_frame.pack(expand=True,fill="both") + + content = [[["Vorname"],["Nachname"],["Geburtsjahr"],["Geschlecht"],["Anwesenheit"]]] + + table = CTkTable(master=self.scrollable_frame, values=content,hover_color=mainColor) + table.pack(expand=True, fill="both", padx=20, pady=(10,20)) + + for i in range(25): + table.add_row([["Max"],["Mustermann"],[2000],["m"],["ja"]], None) + + def window_4(self): # Sportler + self.buttonTest = CTkButton(master=self.main_container, text="Sportler", fg_color=contrastColor, font=("Arial Bold", 14), hover_color=mainColor, anchor="center") self.buttonTest.pack(padx=5, pady=5,expand=True) - def window_4(self): - self.buttonTest = CTkButton(master=self.main_container, text="Spieler", fg_color=contrastColor, font=("Arial Bold", 14), hover_color=mainColor, anchor="center") - self.buttonTest.pack(padx=5, pady=5,expand=True) - - def open_window_settings(self): + def open_window_settings(self): # Einstellungen if self.window_settings is None or not self.window_settings.winfo_exists(): self.window_settings = Window_Settings(self) # create window if its None or destroyed else: @@ -154,6 +164,7 @@ class Main_Window(CTk): for widget in self.main_container.winfo_children(): widget.destroy() +