checkbox support for tabs

This commit is contained in:
admin 2024-02-11 01:04:00 +01:00
parent 7a725dda54
commit 80c6ed7573

View file

@ -54,7 +54,7 @@ def run_installer(download_folder_tmp, col_isDark):
widgets = [] widgets = []
spacing_top = 10 # Adjust the spacing as needed spacing_top = 10 # Adjust the spacing as needed
for index, spec in enumerate(widget_specs): for index, spec in enumerate(widget_specs):
widget = create_widget(spec, container) widget = create_widget(spec, container)
if widget: if widget:
@ -66,7 +66,6 @@ def run_installer(download_folder_tmp, col_isDark):
return widgets return widgets
def create_widget(spec, master): def create_widget(spec, master):
global progress_bar global progress_bar
if isinstance(spec, tuple): if isinstance(spec, tuple):
@ -80,6 +79,8 @@ def run_installer(download_folder_tmp, col_isDark):
# Remove the 'text' argument if it exists # Remove the 'text' argument if it exists
widget_args.pop('text', None) widget_args.pop('text', None)
return CTkComboBox(master=master, **widget_args) return CTkComboBox(master=master, **widget_args)
elif widget_class == CTkCheckBox:
return CTkCheckBox(master=master, **widget_args)
else: else:
return spec(master=master) return spec(master=master)
@ -120,8 +121,8 @@ def run_installer(download_folder_tmp, col_isDark):
tabs = { tabs = {
"Tab1": [ "Tab1": [
(CTkComboBox, {"text": "Language", "values": ["London", "Britan", "New York"]}), (CTkComboBox, {"text": "Language", "values": ["London", "Britan", "New York"]}),
(CTkComboBox, {"text": "Theme", "values": ["System", "Light", "Dark"]}), (CTkComboBox, {"text": "Theme", "values": [f"System {'(Dark)' if col_isDark else '(Light)'}", "Light", "Dark"]}),
(CTkCheckBox, {"text": f"Force {'Dark' if col_isDark else 'Light'} on every website"}), (CTkCheckBox, {"text": f"Force {'dark' if col_isDark else 'light'} mode"}),
(CTkButton, {"text": "Install", "command": switch_to_install_tab}), (CTkButton, {"text": "Install", "command": switch_to_install_tab}),
(CTkButton, {"text": "Customise", "command": switch_to_next_tab}), (CTkButton, {"text": "Customise", "command": switch_to_next_tab}),
], ],