mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
add remain_border to CTkCheckBox
This commit is contained in:
parent
fac2fa5e68
commit
28edb17931
@ -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,9 +199,10 @@ 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))
|
||||||
self._canvas.itemconfig("border_parts",
|
if not self._border_remain:
|
||||||
outline=self._apply_appearance_mode(self._fg_color),
|
self._canvas.itemconfig("border_parts",
|
||||||
fill=self._apply_appearance_mode(self._fg_color))
|
outline=self._apply_appearance_mode(self._fg_color),
|
||||||
|
fill=self._apply_appearance_mode(self._fg_color))
|
||||||
|
|
||||||
if "create_line" in self._canvas.gettags("checkmark"):
|
if "create_line" in self._canvas.gettags("checkmark"):
|
||||||
self._canvas.itemconfig("checkmark", fill=self._apply_appearance_mode(self._checkmark_color))
|
self._canvas.itemconfig("checkmark", fill=self._apply_appearance_mode(self._checkmark_color))
|
||||||
@ -366,9 +369,10 @@ 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))
|
||||||
self._canvas.itemconfig("border_parts",
|
if not self._border_remain:
|
||||||
fill=self._apply_appearance_mode(self._hover_color),
|
self._canvas.itemconfig("border_parts",
|
||||||
outline=self._apply_appearance_mode(self._hover_color))
|
fill=self._apply_appearance_mode(self._hover_color),
|
||||||
|
outline=self._apply_appearance_mode(self._hover_color))
|
||||||
else:
|
else:
|
||||||
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),
|
||||||
@ -379,9 +383,10 @@ 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))
|
||||||
self._canvas.itemconfig("border_parts",
|
if not self._border_remain:
|
||||||
fill=self._apply_appearance_mode(self._fg_color),
|
self._canvas.itemconfig("border_parts",
|
||||||
outline=self._apply_appearance_mode(self._fg_color))
|
fill=self._apply_appearance_mode(self._fg_color),
|
||||||
|
outline=self._apply_appearance_mode(self._fg_color))
|
||||||
else:
|
else:
|
||||||
self._canvas.itemconfig("inner_parts",
|
self._canvas.itemconfig("inner_parts",
|
||||||
fill=self._apply_appearance_mode(self._bg_color),
|
fill=self._apply_appearance_mode(self._bg_color),
|
||||||
|
Loading…
Reference in New Issue
Block a user