fixed some configure bugs #590

This commit is contained in:
Tom Schimansky 2022-11-06 14:44:08 +01:00
parent cea48c3501
commit 1387e834b5

View File

@ -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")