added missing arguments to configure method of combobox, fixed switch canvas positioning

This commit is contained in:
Tom Schimansky
2022-10-23 13:18:48 +02:00
parent db563b3511
commit 90d11e2f3f
4 changed files with 38 additions and 25 deletions

View File

@ -223,15 +223,14 @@ class CTkComboBox(CTkBaseClass):
self._create_grid()
require_redraw = True
if "state" in kwargs:
self._state = kwargs.pop("state")
self._entry.configure(state=self._state)
require_redraw = True
if "fg_color" in kwargs:
self._fg_color = kwargs.pop("fg_color")
require_redraw = True
if "border_color" in kwargs:
self._border_color = kwargs.pop("border_color")
require_redraw = True
if "button_color" in kwargs:
self._button_color = kwargs.pop("button_color")
require_redraw = True
@ -240,10 +239,23 @@ class CTkComboBox(CTkBaseClass):
self._button_hover_color = kwargs.pop("button_hover_color")
require_redraw = True
if "dropdown_fg_color" in kwargs:
self._dropdown_menu.configure(fg_color=kwargs.pop("dropdown_fg_color"))
if "dropdown_hover_color" in kwargs:
self._dropdown_menu.configure(hover_color=kwargs.pop("dropdown_hover_color"))
if "dropdown_text_color" in kwargs:
self._dropdown_menu.configure(text_color=kwargs.pop("dropdown_text_color"))
if "text_color" in kwargs:
self._text_color = kwargs.pop("text_color")
require_redraw = True
if "text_color_disabled" in kwargs:
self._text_color_disabled = kwargs.pop("text_color_disabled")
require_redraw = True
if "font" in kwargs:
if isinstance(self._font, CTkFont):
self._font.remove_size_configure_callback(self._update_font)
@ -253,31 +265,27 @@ class CTkComboBox(CTkBaseClass):
self._update_font()
if "hover" in kwargs:
self._hover = kwargs.pop("hover")
if "command" in kwargs:
self._command = kwargs.pop("command")
if "variable" in kwargs:
self._variable = kwargs.pop("variable")
self._entry.configure(textvariable=self._variable)
if "dropdown_font" in kwargs:
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 "dropdown_fg_color" in kwargs:
self._dropdown_menu.configure(fg_color=kwargs.pop("dropdown_fg_color"))
if "state" in kwargs:
self._state = kwargs.pop("state")
self._entry.configure(state=self._state)
require_redraw = True
if "dropdown_hover_color" in kwargs:
self._dropdown_menu.configure(hover_color=kwargs.pop("dropdown_hover_color"))
if "hover" in kwargs:
self._hover = kwargs.pop("hover")
if "dropdown_text_color" in kwargs:
self._dropdown_menu.configure(text_color=kwargs.pop("dropdown_text_color"))
if "variable" in kwargs:
self._variable = kwargs.pop("variable")
self._entry.configure(textvariable=self._variable)
if "dropdown_font" in kwargs:
self._dropdown_menu.configure(font=kwargs.pop("dropdown_font"))
if "command" in kwargs:
self._command = kwargs.pop("command")
if "justify" in kwargs:
self._entry.configure(justify=kwargs.pop("justify"))

View File

@ -104,7 +104,7 @@ class CTkSwitch(CTkBaseClass):
highlightthickness=0,
width=self._apply_widget_scaling(self._switch_width),
height=self._apply_widget_scaling(self._switch_height))
self._canvas.grid(row=0, column=0, sticky="nswe")
self._canvas.grid(row=0, column=0, sticky="")
self._draw_engine = DrawEngine(self._canvas)
self._canvas.bind("<Enter>", self._on_enter)