Fix: Resolve AttributeError in CTkSwitch and ensure initial dark mode
This commit is contained in:
3
gui.py
3
gui.py
@@ -37,6 +37,7 @@ class VideoConverterGUI:
|
|||||||
# anchor="w" (west) aligns it to the left
|
# anchor="w" (west) aligns it to the left
|
||||||
self.mode_switch.pack(pady=10, padx=20, anchor="w")
|
self.mode_switch.pack(pady=10, padx=20, anchor="w")
|
||||||
self.mode_switch.select() # Start in the "on" (Dark) state
|
self.mode_switch.select() # Start in the "on" (Dark) state
|
||||||
|
self.toggle_mode() # Ensure initial mode is set based on switch state
|
||||||
|
|
||||||
# --- Main Widgets ---
|
# --- Main Widgets ---
|
||||||
self.label = customtkinter.CTkLabel(master, text="Select video file or enter URL:")
|
self.label = customtkinter.CTkLabel(master, text="Select video file or enter URL:")
|
||||||
@@ -88,7 +89,7 @@ class VideoConverterGUI:
|
|||||||
|
|
||||||
def toggle_mode(self):
|
def toggle_mode(self):
|
||||||
# Check if the switch is on (1) or off (0)
|
# Check if the switch is on (1) or off (0)
|
||||||
if self.mode_switch.is_selected():
|
if self.mode_switch.get() == 1:
|
||||||
customtkinter.set_appearance_mode("Dark")
|
customtkinter.set_appearance_mode("Dark")
|
||||||
else:
|
else:
|
||||||
customtkinter.set_appearance_mode("Light")
|
customtkinter.set_appearance_mode("Light")
|
||||||
|
|||||||
Reference in New Issue
Block a user