added text_color_disabled to configure of CTkOptionMenu #1559

This commit is contained in:
Tom Schimansky 2023-05-08 19:11:22 +02:00
parent 6d2f31c23c
commit 1960c0b1e0
2 changed files with 16 additions and 11 deletions

View File

@ -243,6 +243,10 @@ class CTkOptionMenu(CTkBaseClass):
self._text_color = self._check_color_type(kwargs.pop("text_color")) self._text_color = self._check_color_type(kwargs.pop("text_color"))
require_redraw = True require_redraw = True
if "text_color_disabled" in kwargs:
self._text_color_disabled = self._check_color_type(kwargs.pop("text_color_disabled"))
require_redraw = True
if "dropdown_fg_color" in kwargs: if "dropdown_fg_color" in kwargs:
self._dropdown_menu.configure(fg_color=kwargs.pop("dropdown_fg_color")) self._dropdown_menu.configure(fg_color=kwargs.pop("dropdown_fg_color"))
@ -261,8 +265,12 @@ class CTkOptionMenu(CTkBaseClass):
self._update_font() self._update_font()
if "command" in kwargs: if "dropdown_font" in kwargs:
self._command = kwargs.pop("command") self._dropdown_menu.configure(font=kwargs.pop("dropdown_font"))
if "values" in kwargs:
self._values = kwargs.pop("values")
self._dropdown_menu.configure(values=self._values)
if "variable" in kwargs: if "variable" in kwargs:
if self._variable is not None: # remove old callback if self._variable is not None: # remove old callback
@ -277,19 +285,15 @@ class CTkOptionMenu(CTkBaseClass):
else: else:
self._variable = None self._variable = None
if "values" in kwargs: if "state" in kwargs:
self._values = kwargs.pop("values") self._state = kwargs.pop("state")
self._dropdown_menu.configure(values=self._values) require_redraw = True
if "dropdown_font" in kwargs:
self._dropdown_menu.configure(font=kwargs.pop("dropdown_font"))
if "hover" in kwargs: if "hover" in kwargs:
self._hover = kwargs.pop("hover") self._hover = kwargs.pop("hover")
if "state" in kwargs: if "command" in kwargs:
self._state = kwargs.pop("state") self._command = kwargs.pop("command")
require_redraw = True
if "dynamic_resizing" in kwargs: if "dynamic_resizing" in kwargs:
self._dynamic_resizing = kwargs.pop("dynamic_resizing") self._dynamic_resizing = kwargs.pop("dynamic_resizing")

View File

@ -37,6 +37,7 @@ entry_1.pack(pady=10, padx=10)
optionmenu_1 = customtkinter.CTkOptionMenu(frame_1, values=["Option 1", "Option 2", "Option 42 long long long..."]) optionmenu_1 = customtkinter.CTkOptionMenu(frame_1, values=["Option 1", "Option 2", "Option 42 long long long..."])
optionmenu_1.pack(pady=10, padx=10) optionmenu_1.pack(pady=10, padx=10)
optionmenu_1.set("CTkOptionMenu") optionmenu_1.set("CTkOptionMenu")
optionmenu_1.configure(state="disabled", text_color_disabled="red")
combobox_1 = customtkinter.CTkComboBox(frame_1, values=["Option 1", "Option 2", "Option 42 long long long..."]) combobox_1 = customtkinter.CTkComboBox(frame_1, values=["Option 1", "Option 2", "Option 42 long long long..."])
combobox_1.pack(pady=10, padx=10) combobox_1.pack(pady=10, padx=10)