diff --git a/Programm/frame_dashboard.py b/Programm/frame_dashboard.py new file mode 100644 index 0000000..d6333d3 --- /dev/null +++ b/Programm/frame_dashboard.py @@ -0,0 +1,7 @@ +from customtkinter import * +from CTkTable import * +from PIL import Image + +def create(self): + 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) \ No newline at end of file diff --git a/Programm/frame_table.py b/Programm/frame_table.py new file mode 100644 index 0000000..20b363c --- /dev/null +++ b/Programm/frame_table.py @@ -0,0 +1,15 @@ +from customtkinter import * +from CTkTable import * +from PIL import Image + +def create(self): # Werte + self.scrollable_frame = CTkScrollableFrame(self.main_container, label_text="Werte") + self.scrollable_frame.pack(expand=True,fill="both") + + self.content = [[["Vorname"],["Nachname"],["Geburtsjahr"],["Geschlecht"],["Anwesenheit"]]] + + self.table = CTkTable(master=self.scrollable_frame, values=self.content) + self.table.pack(expand=True, fill="both", padx=20, pady=(10,20)) + + for i in range(25): + self.table.add_row([["Max"],["Mustermann"],[2000],["m"],["ja"]], None) \ No newline at end of file diff --git a/Programm/main.py b/Programm/main.py index 3fc650c..814d80b 100644 --- a/Programm/main.py +++ b/Programm/main.py @@ -1,6 +1,9 @@ from customtkinter import * from CTkTable import * from PIL import Image +import frame_table +import frame_dashboard +import colors # Links # - Icons: https://www.flaticon.com @@ -10,8 +13,7 @@ from PIL import Image # Referenzen # - Vorlage: https://github.com/RoyChng/customtkinter-examples/tree/master/Inventory%20Management -mainColor = "#C03F49" -contrastColor = "#8F2F3E" + set_appearance_mode("light") # Bei Änderung muss "text" von Window_Settings/button_appearance ebenfalls geändert werden! @@ -51,7 +53,7 @@ class Main_Window(CTk): self.geometry("%dx%d" % (self.height*16/9*self.downSized, self.height*self.downSized)) set_widget_scaling(self.scale*self.downSized) - self.sidebar_frame = CTkFrame(master=self, fg_color=mainColor, width=176, corner_radius=10*self.scale, bg_color="transparent") + self.sidebar_frame = CTkFrame(master=self, fg_color=colors.mainColor, width=176, corner_radius=10*self.scale, bg_color="transparent") self.sidebar_frame.pack(fill=Y,side=LEFT,anchor="w",padx=5, pady=5) self.img = [Image.open("img/logo_running.png"), @@ -72,27 +74,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", text_color="#fff", 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=colors.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", text_color="#fff", 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=colors.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", text_color="#fff", 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=colors.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", text_color="#fff", 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=colors.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", text_color="#fff", 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=colors.contrastColor, anchor="w", command=self.open_window_settings) self.button5.pack(padx=10, pady=10,side=BOTTOM) self.window_settings = None @@ -110,11 +112,11 @@ class Main_Window(CTk): self.clear_frame() if(windowNumber==1): - self.window_1() + frame_dashboard.create(self) elif(windowNumber==2): self.window_2() elif(windowNumber==3): - self.window_3() + frame_table.create(self) elif(windowNumber==4): self.window_4() @@ -125,33 +127,19 @@ class Main_Window(CTk): img = [self.img_dashboard,self.img_edit,self.img_table,self.img_users] img_red = [self.img_dashboard_red,self.img_edit_red,self.img_table_red,self.img_users_red] - buttons[buttonNumber-1].configure(fg_color="#fff", hover_color="#eee",text_color=mainColor,image=img_red[buttonNumber-1]) + buttons[buttonNumber-1].configure(fg_color="#fff", hover_color="#eee",text_color=colors.mainColor,image=img_red[buttonNumber-1]) if(self.lastButton != None): - buttons[self.lastButton-1].configure(fg_color="transparent", hover_color=contrastColor, text_color="#fff",image=img[self.lastButton-1]) + buttons[self.lastButton-1].configure(fg_color="transparent", hover_color=colors.contrastColor, text_color="#fff",image=img[self.lastButton-1]) self.lastButton = buttonNumber - 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): # Eintragen - self.buttonTest = CTkButton(master=self.main_container, text="Eintragen", fg_color=contrastColor, font=("Arial Bold", 14), hover_color=mainColor, anchor="center") + self.buttonTest = CTkButton(master=self.main_container, text="Eintragen", fg_color=colors.contrastColor, font=("Arial Bold", 14), hover_color=colors.mainColor, anchor="center") self.buttonTest.pack(padx=5, pady=5,expand=True) - 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 = CTkButton(master=self.main_container, text="Sportler", fg_color=colors.contrastColor, font=("Arial Bold", 14), hover_color=colors.mainColor, anchor="center") self.buttonTest.pack(padx=5, pady=5,expand=True) def open_window_settings(self): # Einstellungen diff --git a/Programm/window_dashboard b/Programm/window_dashboard new file mode 100644 index 0000000..e69de29