From 63195943b2b558ee54f5b1e3b62776a16b739b0c Mon Sep 17 00:00:00 2001 From: Tom Schimansky Date: Thu, 6 Oct 2022 15:53:52 +0200 Subject: [PATCH] added master kwarg for all widgets and removed *args --- customtkinter/__init__.py | 1 + customtkinter/assets/themes/blue.json | 5 +- customtkinter/widgets/ctk_button.py | 5 +- customtkinter/widgets/ctk_checkbox.py | 5 +- customtkinter/widgets/ctk_combobox.py | 5 +- customtkinter/widgets/ctk_entry.py | 8 +- customtkinter/widgets/ctk_frame.py | 5 +- customtkinter/widgets/ctk_label.py | 8 +- customtkinter/widgets/ctk_optionmenu.py | 5 +- customtkinter/widgets/ctk_progressbar.py | 5 +- customtkinter/widgets/ctk_radiobutton.py | 5 +- customtkinter/widgets/ctk_scrollbar.py | 5 +- customtkinter/widgets/ctk_segmented_button.py | 19 +++ customtkinter/widgets/ctk_slider.py | 5 +- customtkinter/widgets/ctk_switch.py | 5 +- customtkinter/widgets/ctk_tabview.py | 117 +++++++++++++++++- customtkinter/widgets/ctk_textbox.py | 8 +- customtkinter/widgets/widget_base_class.py | 12 +- .../complex_example_new.py | 2 +- test/manual_integration_tests/test_tabview.py | 16 +++ test/manual_integration_tests/test_textbox.py | 6 +- 21 files changed, 205 insertions(+), 47 deletions(-) create mode 100644 customtkinter/widgets/ctk_segmented_button.py create mode 100644 test/manual_integration_tests/test_tabview.py diff --git a/customtkinter/__init__.py b/customtkinter/__init__.py index f760bd6..86adce8 100644 --- a/customtkinter/__init__.py +++ b/customtkinter/__init__.py @@ -64,6 +64,7 @@ from .widgets.ctk_optionmenu import CTkOptionMenu from .widgets.ctk_combobox import CTkComboBox from .widgets.ctk_scrollbar import CTkScrollbar from .widgets.ctk_textbox import CTkTextbox +from .widgets.ctk_tabview import CTkTabview as _CTkTabview # import windows from .windows.ctk_tk import CTk diff --git a/customtkinter/assets/themes/blue.json b/customtkinter/assets/themes/blue.json index ba7404a..de353f8 100644 --- a/customtkinter/assets/themes/blue.json +++ b/customtkinter/assets/themes/blue.json @@ -35,7 +35,10 @@ "dropdown_hover": ["gray75", "gray28"], "dropdown_text": ["gray10", "#DCE4EE"], "scrollbar_button": ["gray55", "gray41"], - "scrollbar_button_hover": ["gray40", "gray53"] + "scrollbar_button_hover": ["gray40", "gray53"], + "tabview_button_frame": ["gray70", "gray35"], + "tabview_button": ["gray60", "gray45"], + "tabview_button_hover": ["gray50", "gray55"] }, "text": { "macOS": { diff --git a/customtkinter/widgets/ctk_button.py b/customtkinter/widgets/ctk_button.py index a4bdff4..ea828a0 100644 --- a/customtkinter/widgets/ctk_button.py +++ b/customtkinter/widgets/ctk_button.py @@ -15,7 +15,8 @@ class CTkButton(CTkBaseClass): For detailed information check out the documentation. """ - def __init__(self, *args, + def __init__(self, + master: any = None, width: int = 140, height: int = 28, corner_radius: Union[int, str] = "default_theme", @@ -39,7 +40,7 @@ class CTkButton(CTkBaseClass): **kwargs): # transfer basic functionality (_bg_color, size, _appearance_mode, scaling) to CTkBaseClass - super().__init__(*args, bg_color=bg_color, width=width, height=height, **kwargs) + super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs) # color self._fg_color = ThemeManager.theme["color"]["button"] if fg_color == "default_theme" else fg_color diff --git a/customtkinter/widgets/ctk_checkbox.py b/customtkinter/widgets/ctk_checkbox.py index 7cad678..ab09386 100644 --- a/customtkinter/widgets/ctk_checkbox.py +++ b/customtkinter/widgets/ctk_checkbox.py @@ -15,7 +15,8 @@ class CTkCheckBox(CTkBaseClass): For detailed information check out the documentation. """ - def __init__(self, *args, + def __init__(self, + master: any = None, width: int = 24, height: int = 24, corner_radius: Union[int, str] = "default_theme", @@ -41,7 +42,7 @@ class CTkCheckBox(CTkBaseClass): **kwargs): # transfer basic functionality (_bg_color, size, _appearance_mode, scaling) to CTkBaseClass - super().__init__(*args, bg_color=bg_color, width=width, height=height, **kwargs) + super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs) # color self._fg_color = ThemeManager.theme["color"]["button"] if fg_color == "default_theme" else fg_color diff --git a/customtkinter/widgets/ctk_combobox.py b/customtkinter/widgets/ctk_combobox.py index f17fe1f..2149b4d 100644 --- a/customtkinter/widgets/ctk_combobox.py +++ b/customtkinter/widgets/ctk_combobox.py @@ -18,7 +18,8 @@ class CTkComboBox(CTkBaseClass): For detailed information check out the documentation. """ - def __init__(self, *args, + def __init__(self, + master: any = None, width: int = 140, height: int = 28, corner_radius: Union[int, str] = "default_theme", @@ -45,7 +46,7 @@ class CTkComboBox(CTkBaseClass): **kwargs): # transfer basic functionality (_bg_color, size, _appearance_mode, scaling) to CTkBaseClass - super().__init__(*args, bg_color=bg_color, width=width, height=height, **kwargs) + super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs) # color variables self._fg_color = ThemeManager.theme["color"]["entry"] if fg_color == "default_theme" else fg_color diff --git a/customtkinter/widgets/ctk_entry.py b/customtkinter/widgets/ctk_entry.py index ef5ad99..72c317a 100644 --- a/customtkinter/widgets/ctk_entry.py +++ b/customtkinter/widgets/ctk_entry.py @@ -22,7 +22,8 @@ class CTkEntry(CTkBaseClass): "insertontime", "insertwidth", "justify", "selectborderwidth", "show", "takefocus", "validate", "validatecommand", "xscrollcommand"} - def __init__(self, *args, + def __init__(self, + master: any = None, width: int = 140, height: int = 28, corner_radius: int = "default_theme", @@ -41,10 +42,7 @@ class CTkEntry(CTkBaseClass): **kwargs): # transfer basic functionality (bg_color, size, appearance_mode, scaling) to CTkBaseClass - if "master" in kwargs: - super().__init__(*args, bg_color=bg_color, width=width, height=height, master=kwargs.pop("master")) - else: - super().__init__(*args, bg_color=bg_color, width=width, height=height) + super().__init__(master=master, bg_color=bg_color, width=width, height=height) # configure grid system (1x1) self.grid_rowconfigure(0, weight=1) diff --git a/customtkinter/widgets/ctk_frame.py b/customtkinter/widgets/ctk_frame.py index e27c604..2c69ccd 100644 --- a/customtkinter/widgets/ctk_frame.py +++ b/customtkinter/widgets/ctk_frame.py @@ -14,7 +14,8 @@ class CTkFrame(CTkBaseClass): For detailed information check out the documentation. """ - def __init__(self, *args, + def __init__(self, + master: any = None, width: int = 200, height: int = 200, corner_radius: Union[int, str] = "default_theme", @@ -28,7 +29,7 @@ class CTkFrame(CTkBaseClass): **kwargs): # transfer basic functionality (_bg_color, size, _appearance_mode, scaling) to CTkBaseClass - super().__init__(*args, bg_color=bg_color, width=width, height=height, **kwargs) + super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs) # color self._border_color = ThemeManager.theme["color"]["frame_border"] if border_color == "default_theme" else border_color diff --git a/customtkinter/widgets/ctk_label.py b/customtkinter/widgets/ctk_label.py index 102cb46..3092f29 100644 --- a/customtkinter/widgets/ctk_label.py +++ b/customtkinter/widgets/ctk_label.py @@ -19,7 +19,8 @@ class CTkLabel(CTkBaseClass): _valid_tk_label_attributes = {"compound", "cursor", "image", "justify", "padx", "pady", "textvariable", "state", "takefocus", "underline", "wraplength"} - def __init__(self, *args, + def __init__(self, + master: any = None, width: int = 140, height: int = 28, corner_radius: Union[int, str] = "default_theme", @@ -34,10 +35,7 @@ class CTkLabel(CTkBaseClass): **kwargs): # transfer basic functionality (_bg_color, size, _appearance_mode, scaling) to CTkBaseClass - if "master" in kwargs: - super().__init__(*args, bg_color=bg_color, width=width, height=height, master=kwargs.pop("master")) - else: - super().__init__(*args, bg_color=bg_color, width=width, height=height) + super().__init__(master=master, bg_color=bg_color, width=width, height=height) # color self._fg_color = ThemeManager.theme["color"]["label"] if fg_color == "default_theme" else fg_color diff --git a/customtkinter/widgets/ctk_optionmenu.py b/customtkinter/widgets/ctk_optionmenu.py index 8317480..63ec324 100644 --- a/customtkinter/widgets/ctk_optionmenu.py +++ b/customtkinter/widgets/ctk_optionmenu.py @@ -16,7 +16,8 @@ class CTkOptionMenu(CTkBaseClass): For detailed information check out the documentation. """ - def __init__(self, *args, + def __init__(self, + master: any = None, width: int = 140, height: int = 28, corner_radius: Union[int, str] = "default_theme", @@ -42,7 +43,7 @@ class CTkOptionMenu(CTkBaseClass): **kwargs): # transfer basic functionality (_bg_color, size, _appearance_mode, scaling) to CTkBaseClass - super().__init__(*args, bg_color=bg_color, width=width, height=height, **kwargs) + super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs) # color variables self._fg_color = ThemeManager.theme["color"]["button"] if fg_color == "default_theme" else fg_color diff --git a/customtkinter/widgets/ctk_progressbar.py b/customtkinter/widgets/ctk_progressbar.py index 5b34ffc..7b34292 100644 --- a/customtkinter/widgets/ctk_progressbar.py +++ b/customtkinter/widgets/ctk_progressbar.py @@ -15,7 +15,8 @@ class CTkProgressBar(CTkBaseClass): For detailed information check out the documentation. """ - def __init__(self, *args, + def __init__(self, + master: any = None, width: Union[int, str] = "default_init", height: Union[int, str] = "default_init", corner_radius: Union[str, Tuple[str, str]] = "default_theme", @@ -46,7 +47,7 @@ class CTkProgressBar(CTkBaseClass): height = 8 # transfer basic functionality (_bg_color, size, _appearance_mode, scaling) to CTkBaseClass - super().__init__(*args, bg_color=bg_color, width=width, height=height, **kwargs) + super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs) # color self._border_color = ThemeManager.theme["color"]["progressbar_border"] if border_color == "default_theme" else border_color diff --git a/customtkinter/widgets/ctk_radiobutton.py b/customtkinter/widgets/ctk_radiobutton.py index 42f07fb..548a582 100644 --- a/customtkinter/widgets/ctk_radiobutton.py +++ b/customtkinter/widgets/ctk_radiobutton.py @@ -15,7 +15,8 @@ class CTkRadioButton(CTkBaseClass): For detailed information check out the documentation. """ - def __init__(self, *args, + def __init__(self, + master: any = None, width: int = 22, height: int = 22, corner_radius: Union[int, str] = "default_theme", @@ -40,7 +41,7 @@ class CTkRadioButton(CTkBaseClass): **kwargs): # transfer basic functionality (_bg_color, size, _appearance_mode, scaling) to CTkBaseClass - super().__init__(*args, bg_color=bg_color, width=width, height=height, **kwargs) + super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs) # color self._fg_color = ThemeManager.theme["color"]["button"] if fg_color == "default_theme" else fg_color diff --git a/customtkinter/widgets/ctk_scrollbar.py b/customtkinter/widgets/ctk_scrollbar.py index 86731ce..acf82ea 100644 --- a/customtkinter/widgets/ctk_scrollbar.py +++ b/customtkinter/widgets/ctk_scrollbar.py @@ -14,7 +14,8 @@ class CTkScrollbar(CTkBaseClass): For detailed information check out the documentation. """ - def __init__(self, *args, + def __init__(self, + master: any = None, width: Union[int, str] = "default_init", height: Union[int, str] = "default_init", corner_radius: Union[int, str] = "default_theme", @@ -44,7 +45,7 @@ class CTkScrollbar(CTkBaseClass): height = 200 # transfer basic functionality (_bg_color, size, _appearance_mode, scaling) to CTkBaseClass - super().__init__(*args, bg_color=bg_color, width=width, height=height, **kwargs) + super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs) # color self._fg_color = ThemeManager.theme["color"]["frame_high"] if fg_color == "default_theme" else fg_color diff --git a/customtkinter/widgets/ctk_segmented_button.py b/customtkinter/widgets/ctk_segmented_button.py new file mode 100644 index 0000000..7206a40 --- /dev/null +++ b/customtkinter/widgets/ctk_segmented_button.py @@ -0,0 +1,19 @@ +import tkinter +from typing import Union, Tuple + +from .widget_base_class import CTkBaseClass +from .ctk_button import CTkButton + + +class CTkSegmentedButton(CTkBaseClass): + def __init__(self, + master: any = None, + bg_color: Union[str, Tuple[str, str], None] = None, + fg_color: Union[str, Tuple[str, str], None] = "default_theme", + hover_color: Union[str, Tuple[str, str]] = "default_theme", + text_color: Union[str, Tuple[str, str]] = "default_theme", + text_color_disabled: Union[str, Tuple[str, str]] = "default_theme", + + values: list = None): + super().__init__(master=master, ) + diff --git a/customtkinter/widgets/ctk_slider.py b/customtkinter/widgets/ctk_slider.py index cce9379..3de5eb3 100644 --- a/customtkinter/widgets/ctk_slider.py +++ b/customtkinter/widgets/ctk_slider.py @@ -15,7 +15,8 @@ class CTkSlider(CTkBaseClass): For detailed information check out the documentation. """ - def __init__(self, *args, + def __init__(self, + master: any = None, width: Union[int, str] = "default_init", height: Union[int, str] = "default_init", corner_radius: Union[int, str] = "default_theme", @@ -52,7 +53,7 @@ class CTkSlider(CTkBaseClass): height = 16 # transfer basic functionality (_bg_color, size, _appearance_mode, scaling) to CTkBaseClass - super().__init__(*args, bg_color=bg_color, width=width, height=height, **kwargs) + super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs) # color self._border_color = border_color diff --git a/customtkinter/widgets/ctk_switch.py b/customtkinter/widgets/ctk_switch.py index 62269cf..dbdfe7f 100644 --- a/customtkinter/widgets/ctk_switch.py +++ b/customtkinter/widgets/ctk_switch.py @@ -15,7 +15,8 @@ class CTkSwitch(CTkBaseClass): For detailed information check out the documentation. """ - def __init__(self, *args, + def __init__(self, + master: any = None, width: int = 36, height: int = 18, corner_radius: Union[int, str] = "default_theme", @@ -42,7 +43,7 @@ class CTkSwitch(CTkBaseClass): **kwargs): # transfer basic functionality (_bg_color, size, _appearance_mode, scaling) to CTkBaseClass - super().__init__(*args, bg_color=bg_color, width=width, height=height, **kwargs) + super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs) # color self._border_color = border_color diff --git a/customtkinter/widgets/ctk_tabview.py b/customtkinter/widgets/ctk_tabview.py index 1f9f5b3..0d788f6 100644 --- a/customtkinter/widgets/ctk_tabview.py +++ b/customtkinter/widgets/ctk_tabview.py @@ -1,8 +1,121 @@ +import tkinter +from typing import Union, Tuple, List + +from ..theme_manager import ThemeManager from .widget_base_class import CTkBaseClass +from .ctk_frame import CTkFrame + + +class CTkTab: + def __init__(self, master=None, identifier: str = None, text: str = "CTkTab", index: int = 0): + self.text: str = text + self.frame: tkinter.Frame = tkinter.Frame(master, width=0, height=0) + self.identifier = str(id(self.frame)) if identifier is None else identifier + self.visible: bool = True + self.index = index class CTkTabview(CTkBaseClass): - def __init__(self, *args, + """ + Tabview... + For detailed information check out the documentation. + """ + + _top_spacing = 10 # px on top of the buttons + _top_button_overhang = 8 # px + _button_size = 24 + + def __init__(self, + master: any = None, + width: int = 300, + height: int = 250, + corner_radius: Union[int, str] = "default_theme", + border_width: Union[int, str] = "default_theme", + + bg_color: Union[str, Tuple[str, str], None] = None, + fg_color: Union[str, Tuple[str, str], None] = "default_theme", + + button_frame_color: Union[str, Tuple[str, str]] = "default_theme", + button_color: Union[str, Tuple[str, str]] = "default_theme", + button_hover_color: Union[str, Tuple[str, str]] = "default_theme", + border_color: Union[str, Tuple[str, str]] = "default_theme", + **kwargs): - super().__init__(*args, **kwargs) + + # transfer basic functionality (bg_color, size, appearance_mode, scaling) to CTkBaseClass + super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs) + + # determine fg_color + if fg_color == "default_theme": + if isinstance(self.master, (CTkFrame, CTkTabview)): + if self.master.cget("fg_color") == ThemeManager.theme["color"]["frame_low"]: + self._fg_color = ThemeManager.theme["color"]["frame_high"] + else: + self._fg_color = ThemeManager.theme["color"]["frame_low"] + else: + self._fg_color = ThemeManager.theme["color"]["frame_low"] + else: + self._fg_color = fg_color + + self._border_color = ThemeManager.theme["color"]["frame_border"] if border_color == "default_theme" else border_color + self._button_frame_color = ThemeManager.theme["color"]["tabview_button_frame"] if button_frame_color == "default_theme" else button_frame_color + self._button_color = ThemeManager.theme["color"]["tabview_button"] if button_color == "default_theme" else button_color + self._button_hover_color = ThemeManager.theme["color"]["tabview_button_hover"] if button_hover_color == "default_theme" else button_hover_color + + # shape + self._corner_radius = ThemeManager.theme["shape"]["frame_corner_radius"] if corner_radius == "default_theme" else corner_radius + self._border_width = ThemeManager.theme["shape"]["frame_border_width"] if border_width == "default_theme" else border_width + + self._main_frame = CTkFrame(self, + width=width, + height=height - (self._top_spacing + self._top_button_overhang), + bg_color=self._bg_color, + fg_color=self._fg_color, + border_color=self._border_color, + border_width=self._border_width) + self._button_frame = CTkFrame(self, + width=0, + height=0, + bg_color=self._fg_color, + fg_color=self._button_frame_color, + border_color=self._border_color, + border_width=self._border_width) + self._create_grid_for_frames() + + self._tab_list: List[CTkTab] = [] + + def _create_grid_for_frames(self): + """ create 3 x 4 grid system """ + + self.grid_rowconfigure(0, weight=0, minsize=self._apply_widget_scaling(self._top_spacing)) + self.grid_rowconfigure(1, weight=0, minsize=self._apply_widget_scaling(self._top_button_overhang)) + self.grid_rowconfigure(2, weight=0, minsize=self._apply_widget_scaling(self._button_size - self._top_button_overhang)) + self.grid_rowconfigure(3, weight=1) + + self.grid_columnconfigure((0, 2), weight=1, minsize=self._apply_widget_scaling(self._corner_radius)) + self.grid_columnconfigure(1, weight=0, minsize=self._apply_widget_scaling(self._corner_radius)) + + self._main_frame.grid(row=2, column=0, rowspan=2, columnspan=3, sticky="nsew") + self._button_frame.grid(row=1, column=1, rowspan=2, columnspan=1, sticky="nsew") + + def _get_tab_by_identifier(self, identifier: str): + for tab in self._tab_list: + if tab.identifier == identifier: + return tab + + def create_tab(self, identifier=None, text="CTkTabview"): + new_tab = CTkTab(master=self, identifier=identifier, text=text) + self._tab_list.append(new_tab) + return new_tab.identifier + + def select_tab(self, identifier: str): + selected_tab = self._get_tab_by_identifier(identifier) + for tab in self._tab_list: + if tab != selected_tab: + tab.frame.grid_forget() + + selected_tab.frame.grid(row=3, column=0, rowspan=1, columnspan=3, sticky="nsew") + + def get_tab(self, identifier): pass + diff --git a/customtkinter/widgets/ctk_textbox.py b/customtkinter/widgets/ctk_textbox.py index a86a149..ec705ef 100644 --- a/customtkinter/widgets/ctk_textbox.py +++ b/customtkinter/widgets/ctk_textbox.py @@ -31,7 +31,8 @@ class CTkTextbox(CTkBaseClass): "spacing2", "spacing3", "state", "tabs", "takefocus", "undo", "wrap", "xscrollcommand", "yscrollcommand"} - def __init__(self, *args, + def __init__(self, + master: any = None, width: int = 200, height: int = 200, corner_radius: Union[int, str] = "default_theme", @@ -50,10 +51,7 @@ class CTkTextbox(CTkBaseClass): **kwargs): # transfer basic functionality (_bg_color, size, _appearance_mode, scaling) to CTkBaseClass - if "master" in kwargs: - super().__init__(*args, bg_color=bg_color, width=width, height=height, master=kwargs.pop("master")) - else: - super().__init__(*args, bg_color=bg_color, width=width, height=height) + super().__init__(master=master, bg_color=bg_color, width=width, height=height) # color self._fg_color = ThemeManager.theme["color"]["entry"] if fg_color == "default_theme" else fg_color diff --git a/customtkinter/widgets/widget_base_class.py b/customtkinter/widgets/widget_base_class.py index f7c5865..a8c922b 100644 --- a/customtkinter/widgets/widget_base_class.py +++ b/customtkinter/widgets/widget_base_class.py @@ -23,16 +23,17 @@ class CTkBaseClass(tkinter.Frame): appearance_mode changes, scaling, bg changes of master if master is not a CTk widget """ # attributes that are passed to and managed by the tkinter frame only: - _valid_tk_frame_attributes = {"cursor", "master"} + _valid_tk_frame_attributes = {"cursor"} - def __init__(self, *args, - width: int, - height: int, + def __init__(self, + master: any = None, + width: int = 0, + height: int = 0, bg_color: Union[str, tuple] = None, **kwargs): - super().__init__(*args, width=width, height=height, **pop_from_dict_by_set(kwargs, self._valid_tk_frame_attributes)) + super().__init__(master=master, width=width, height=height, **pop_from_dict_by_set(kwargs, self._valid_tk_frame_attributes)) # check if kwargs is empty, if not raise error for unsupported arguments self._check_kwargs_empty(kwargs, raise_error=True) @@ -231,6 +232,7 @@ class CTkBaseClass(tkinter.Frame): elif mode_string.lower() == "light": self._appearance_mode = 0 + super().configure(bg=ThemeManager.single_color(self._bg_color, self._appearance_mode)) self._draw() def _set_scaling(self, new_widget_scaling, new_spacing_scaling, new_window_scaling): diff --git a/test/manual_integration_tests/complex_example_new.py b/test/manual_integration_tests/complex_example_new.py index 6e721be..8a69461 100644 --- a/test/manual_integration_tests/complex_example_new.py +++ b/test/manual_integration_tests/complex_example_new.py @@ -49,7 +49,7 @@ class App(customtkinter.CTk): self.entry = customtkinter.CTkEntry(self, placeholder_text="CTkEntry") self.entry.grid(row=3, column=1, columnspan=2, padx=(20, 10), pady=(10, 20), sticky="nsew") - self.main_button_1 = customtkinter.CTkButton(self, fg_color=None, border_width=2) + self.main_button_1 = customtkinter.CTkButton(master=self, fg_color=None, border_width=2) self.main_button_1.grid(row=3, column=3, padx=(10, 20), pady=(10, 20), sticky="nsew") self.textbox = customtkinter.CTkTextbox(self) diff --git a/test/manual_integration_tests/test_tabview.py b/test/manual_integration_tests/test_tabview.py new file mode 100644 index 0000000..f45f14e --- /dev/null +++ b/test/manual_integration_tests/test_tabview.py @@ -0,0 +1,16 @@ +import customtkinter +import tkinter.ttk as ttk + +app = customtkinter.CTk() + +tabview = customtkinter._CTkTabview(app) +tabview.pack(pady=20, padx=20) + +tabview.create_tab(identifier="tab1", text="Tab 1") +tabview.select_tab("tab1") + + +switch = customtkinter.CTkSwitch(app, text="Darkmode", onvalue="dark", offvalue="light", + command=lambda: customtkinter.set_appearance_mode(switch.get())) +switch.pack(padx=20, pady=20) +app.mainloop() diff --git a/test/manual_integration_tests/test_textbox.py b/test/manual_integration_tests/test_textbox.py index c8d2e0c..4f90d79 100644 --- a/test/manual_integration_tests/test_textbox.py +++ b/test/manual_integration_tests/test_textbox.py @@ -1,8 +1,8 @@ import customtkinter -customtkinter.set_widget_scaling(0.9) -customtkinter.set_window_scaling(0.9) -customtkinter.set_spacing_scaling(0.9) +#customtkinter.set_widget_scaling(0.9) +#customtkinter.set_window_scaling(0.9) +#customtkinter.set_spacing_scaling(0.9) customtkinter.set_appearance_mode("dark")