diff --git a/Readme.md b/Readme.md index 6522115..24af68c 100644 --- a/Readme.md +++ b/Readme.md @@ -33,8 +33,7 @@ pip3 install customtkinter The **official** documentation can be found in the Wiki Tab here: -### **--> [Documentation](https://github.com/TomSchimansky/CustomTkinter/wiki)**. - +**--> [Documentation](https://github.com/TomSchimansky/CustomTkinter/wiki)**. ## Example Program To test customtkinter you can try this simple example with only a single button: diff --git a/customtkinter/widgets/ctk_combobox.py b/customtkinter/widgets/ctk_combobox.py index 0dbc0d3..3af5186 100644 --- a/customtkinter/widgets/ctk_combobox.py +++ b/customtkinter/widgets/ctk_combobox.py @@ -268,7 +268,7 @@ class CTkComboBox(CTkBaseClass): outline=ThemeManager.single_color(self.button_color, self._appearance_mode), fill=ThemeManager.single_color(self.button_color, self._appearance_mode)) - def set(self, value: str, from_variable_callback: bool = False): + def set(self, value: str, from_variable_callback: bool = False, from_dropdown_menu_callback: bool = False): self.current_value = value if self.state == "readonly": @@ -280,7 +280,7 @@ class CTkComboBox(CTkBaseClass): self.entry.delete(0, tkinter.END) self.entry.insert(0, self.current_value) - if not from_variable_callback: + if from_dropdown_menu_callback: if self.command is not None: self.command(self.current_value) diff --git a/customtkinter/widgets/ctk_optionmenu.py b/customtkinter/widgets/ctk_optionmenu.py index 95e67e7..c290fff 100644 --- a/customtkinter/widgets/ctk_optionmenu.py +++ b/customtkinter/widgets/ctk_optionmenu.py @@ -279,7 +279,7 @@ class CTkOptionMenu(CTkBaseClass): if not self.variable_callback_blocked: self.set(self.variable.get(), from_variable_callback=True) - def set(self, value: str, from_variable_callback: bool = False): + def set(self, value: str, from_variable_callback: bool = False, from_dropdown_menu_callback: bool = False): self.current_value = value self.text_label.configure(text=self.current_value) @@ -289,7 +289,7 @@ class CTkOptionMenu(CTkBaseClass): self.variable.set(self.current_value) self.variable_callback_blocked = False - if not from_variable_callback: + if from_dropdown_menu_callback: if self.command is not None: self.command(self.current_value) diff --git a/customtkinter/widgets/dropdown_menu.py b/customtkinter/widgets/dropdown_menu.py index a553c47..57c5af8 100644 --- a/customtkinter/widgets/dropdown_menu.py +++ b/customtkinter/widgets/dropdown_menu.py @@ -96,7 +96,7 @@ class DropdownMenu(tkinter.Menu): def button_callback(self, value): if self.command is not None: - self.command(value) + self.command(value, from_dropdown_menu_callback=True) def configure(self, **kwargs): if "values" in kwargs: diff --git a/test/manual_integration_tests/test_optionmenu_combobox.py b/test/manual_integration_tests/test_optionmenu_combobox.py index 31bf6da..3c75360 100644 --- a/test/manual_integration_tests/test_optionmenu_combobox.py +++ b/test/manual_integration_tests/test_optionmenu_combobox.py @@ -27,10 +27,10 @@ optionmenu_2 = customtkinter.CTkOptionMenu(app, variable=variable, values=countr dynamic_resizing=False) optionmenu_2.pack(pady=20, padx=10) -combobox_tk = ttk.Combobox(app, values=countries) +combobox_tk = ttk.Combobox(app, values=countries, textvariable=variable) combobox_tk.pack(pady=10, padx=10) -combobox_1 = customtkinter.CTkComboBox(app, variable=None, values=countries, command=select_callback, width=300) +combobox_1 = customtkinter.CTkComboBox(app, variable=variable, values=countries, command=select_callback, width=300) combobox_1.pack(pady=20, padx=10) def set_new_scaling(scaling):