|
|
|
|
@ -12,21 +12,46 @@ from PIL import Image
|
|
|
|
|
mainColor = "#C03F49"
|
|
|
|
|
contrastColor = "#8F2F3E"
|
|
|
|
|
|
|
|
|
|
app = CTk()
|
|
|
|
|
height= app.winfo_screenheight()
|
|
|
|
|
scale = height/720
|
|
|
|
|
downSized = 0.8
|
|
|
|
|
app.geometry("%dx%d" % (height*16/9*downSized, height*downSized))
|
|
|
|
|
app.configure(bg_color="White",fg_color="White")
|
|
|
|
|
|
|
|
|
|
set_appearance_mode("light")
|
|
|
|
|
set_widget_scaling(scale*downSized)
|
|
|
|
|
|
|
|
|
|
class Window_Settings(CTkToplevel):
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
|
|
|
|
|
|
class Sidebar():
|
|
|
|
|
def __init__(self):
|
|
|
|
|
self.downSized = 0.5
|
|
|
|
|
self.geometry("%dx%d" % (self.master.height*16/9*self.downSized, self.master.height*self.downSized))
|
|
|
|
|
self.title("Einstellungen")
|
|
|
|
|
|
|
|
|
|
self.sidebar_frame = CTkFrame(master=app, fg_color=mainColor, width=176, corner_radius=10,bg_color="White")
|
|
|
|
|
self.frame_appearance = CTkFrame(master=self)
|
|
|
|
|
self.frame_appearance.pack(expand=True)
|
|
|
|
|
|
|
|
|
|
self.label = CTkLabel(self.frame_appearance, text="Erscheinung")
|
|
|
|
|
self.label.pack(padx=5, pady=5)
|
|
|
|
|
|
|
|
|
|
self.img_appearance = CTkImage(dark_image=Image.open("img/icons/moon_black.png"), light_image=Image.open("img/icons/sun_white.png"))
|
|
|
|
|
self.button_appearance = CTkButton(master=self.frame_appearance, image=self.img_appearance, text="Hell", text_color =("White","Black"),fg_color=("Black","White"), font=("Arial Bold", 14), hover_color=("#1A1A1A","#E6E6E6"), anchor="w",command=self.toggleAppearance)
|
|
|
|
|
self.button_appearance.pack(padx=5, pady=5)
|
|
|
|
|
|
|
|
|
|
def toggleAppearance(self):
|
|
|
|
|
if(self.button_appearance.cget("text")=="Dunkel"):
|
|
|
|
|
self.button_appearance.configure(text="Hell")
|
|
|
|
|
set_appearance_mode("light")
|
|
|
|
|
else:
|
|
|
|
|
self.button_appearance.configure(text="Dunkel")
|
|
|
|
|
set_appearance_mode("dark")
|
|
|
|
|
|
|
|
|
|
class Main_Window(CTk):
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
|
|
|
|
|
|
self.title("Bundesjugendspiele-GUI")
|
|
|
|
|
self.height= self.winfo_screenheight()
|
|
|
|
|
self.scale = self.height/720
|
|
|
|
|
self.downSized = 0.8
|
|
|
|
|
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="White")
|
|
|
|
|
self.sidebar_frame.pack(fill=Y,side=LEFT,anchor="w",padx=5, pady=5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -52,9 +77,17 @@ class Sidebar():
|
|
|
|
|
self.button4.pack(padx=5, pady=5)
|
|
|
|
|
|
|
|
|
|
self.img_settings = CTkImage(dark_image=Image.open("img/icons/settings_white.png"), light_image=Image.open("img/icons/settings_white.png"))
|
|
|
|
|
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")
|
|
|
|
|
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.pack(padx=10, pady=10,side=BOTTOM)
|
|
|
|
|
|
|
|
|
|
s = Sidebar()
|
|
|
|
|
self.window_settings = None
|
|
|
|
|
|
|
|
|
|
def open_window_settings(self):
|
|
|
|
|
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:
|
|
|
|
|
self.window_settings.focus() # if window exists focus it
|
|
|
|
|
|
|
|
|
|
app = Main_Window()
|
|
|
|
|
|
|
|
|
|
app.mainloop()
|
|
|
|
|
|