diff --git a/Programm/main.py b/Programm/main.py index 7eeedd3..b57ee20 100644 --- a/Programm/main.py +++ b/Programm/main.py @@ -49,7 +49,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, bg_color="transparent") + self.sidebar_frame = CTkFrame(master=self, fg_color=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) @@ -83,28 +83,34 @@ class Main_Window(CTk): self.main_container = CTkFrame(self, corner_radius=10) self.main_container.pack(fill=BOTH, expand=True, padx=(0,5), pady=5,side=RIGHT) + + self.lastButton = None self.initiate_window_1() def initiate_window_1(self): - print("c Dashboard") + self.updateButton(self.button1) + self.clear_frame() 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 initiate_window_2(self): - print("c Edit") + self.updateButton(self.button2) + self.clear_frame() 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 initiate_window_3(self): - print("c Edit") + self.updateButton(self.button3) + self.clear_frame() self.buttonTest = CTkButton(master=self.main_container, text="Werte", fg_color=contrastColor, font=("Arial Bold", 14), hover_color=mainColor, anchor="center") self.buttonTest.pack(padx=5, pady=5,expand=True) def initiate_window_4(self): - print("c Edit") + self.updateButton(self.button4) + self.clear_frame() 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) @@ -114,10 +120,20 @@ class Main_Window(CTk): self.window_settings = Window_Settings(self) # create window if its None or destroyed else: self.window_settings.focus() # if window exists focus it - + + def updateButton(self,button): + if(button != self.lastButton): + button.configure(fg_color="#fff", hover_color="#eee",text_color=mainColor) + if(self.lastButton != None): + self.lastButton.configure(fg_color="transparent", hover_color=contrastColor, text_color="#fff") + self.lastButton = button + def clear_frame(self): for widget in self.main_container.winfo_children(): widget.destroy() + + + app = Main_Window()