From 1387e834b5c3608e430780320dd4a7814b88e099 Mon Sep 17 00:00:00 2001 From: Tom Schimansky Date: Sun, 6 Nov 2022 14:44:08 +0100 Subject: [PATCH] fixed some configure bugs #590 --- customtkinter/windows/widgets/ctk_switch.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/customtkinter/windows/widgets/ctk_switch.py b/customtkinter/windows/widgets/ctk_switch.py index d876c7b..cc6f113 100644 --- a/customtkinter/windows/widgets/ctk_switch.py +++ b/customtkinter/windows/widgets/ctk_switch.py @@ -244,6 +244,18 @@ class CTkSwitch(CTkBaseClass): self._text_label.configure(bg=self._apply_appearance_mode(self._bg_color)) def configure(self, require_redraw=False, **kwargs): + if "corner_radius" in kwargs: + self._corner_radius = kwargs.pop("corner_radius") + require_redraw = True + + if "border_width" in kwargs: + self._border_width = kwargs.pop("border_width") + require_redraw = True + + if "button_length" in kwargs: + self._button_length = kwargs.pop("button_length") + require_redraw = True + if "switch_width" in kwargs: self._switch_width = kwargs.pop("switch_width") self._canvas.configure(width=self._apply_widget_scaling(self._switch_width)) @@ -296,10 +308,6 @@ class CTkSwitch(CTkBaseClass): self._border_color = kwargs.pop("border_color") require_redraw = True - if "border_width" in kwargs: - self._border_width = kwargs.pop("border_width") - require_redraw = True - if "hover" in kwargs: self._hover = kwargs.pop("hover")