mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
changed combobox and optionemnu command to only get triggered by manual selection #440
This commit is contained in:
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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:
|
||||
|
Reference in New Issue
Block a user