add remain_border to CTkCheckBox

This commit is contained in:
M4hbod 2023-01-10 16:31:34 +03:30
parent fac2fa5e68
commit 28edb17931

View File

@ -37,6 +37,7 @@ class CTkCheckBox(CTkBaseClass):
textvariable: Union[tkinter.Variable, None] = None, textvariable: Union[tkinter.Variable, None] = None,
state: str = tkinter.NORMAL, state: str = tkinter.NORMAL,
hover: bool = True, hover: bool = True,
border_remain: bool = False,
command: Union[Callable[[], None], None] = None, command: Union[Callable[[], None], None] = None,
onvalue: Union[int, str] = 1, onvalue: Union[int, str] = 1,
offvalue: Union[int, str] = 0, offvalue: Union[int, str] = 0,
@ -75,6 +76,7 @@ class CTkCheckBox(CTkBaseClass):
self._command = command self._command = command
self._state = state self._state = state
self._hover = hover self._hover = hover
self._border_remain = border_remain
self._check_state = False self._check_state = False
self._onvalue = onvalue self._onvalue = onvalue
@ -197,6 +199,7 @@ class CTkCheckBox(CTkBaseClass):
self._canvas.itemconfig("inner_parts", self._canvas.itemconfig("inner_parts",
outline=self._apply_appearance_mode(self._fg_color), outline=self._apply_appearance_mode(self._fg_color),
fill=self._apply_appearance_mode(self._fg_color)) fill=self._apply_appearance_mode(self._fg_color))
if not self._border_remain:
self._canvas.itemconfig("border_parts", self._canvas.itemconfig("border_parts",
outline=self._apply_appearance_mode(self._fg_color), outline=self._apply_appearance_mode(self._fg_color),
fill=self._apply_appearance_mode(self._fg_color)) fill=self._apply_appearance_mode(self._fg_color))
@ -366,6 +369,7 @@ class CTkCheckBox(CTkBaseClass):
self._canvas.itemconfig("inner_parts", self._canvas.itemconfig("inner_parts",
fill=self._apply_appearance_mode(self._hover_color), fill=self._apply_appearance_mode(self._hover_color),
outline=self._apply_appearance_mode(self._hover_color)) outline=self._apply_appearance_mode(self._hover_color))
if not self._border_remain:
self._canvas.itemconfig("border_parts", self._canvas.itemconfig("border_parts",
fill=self._apply_appearance_mode(self._hover_color), fill=self._apply_appearance_mode(self._hover_color),
outline=self._apply_appearance_mode(self._hover_color)) outline=self._apply_appearance_mode(self._hover_color))
@ -379,6 +383,7 @@ class CTkCheckBox(CTkBaseClass):
self._canvas.itemconfig("inner_parts", self._canvas.itemconfig("inner_parts",
fill=self._apply_appearance_mode(self._fg_color), fill=self._apply_appearance_mode(self._fg_color),
outline=self._apply_appearance_mode(self._fg_color)) outline=self._apply_appearance_mode(self._fg_color))
if not self._border_remain:
self._canvas.itemconfig("border_parts", self._canvas.itemconfig("border_parts",
fill=self._apply_appearance_mode(self._fg_color), fill=self._apply_appearance_mode(self._fg_color),
outline=self._apply_appearance_mode(self._fg_color)) outline=self._apply_appearance_mode(self._fg_color))