From 6e36ec818eedcdc8682e74167098841bf34122b0 Mon Sep 17 00:00:00 2001 From: Mohsen Sadi Date: Wed, 8 Jun 2022 07:11:52 -0400 Subject: [PATCH] checkbox.check_state initialization fixed --- customtkinter/widgets/ctk_checkbox.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/customtkinter/widgets/ctk_checkbox.py b/customtkinter/widgets/ctk_checkbox.py index 86216b4..d25de08 100644 --- a/customtkinter/widgets/ctk_checkbox.py +++ b/customtkinter/widgets/ctk_checkbox.py @@ -63,7 +63,10 @@ class CTkCheckBox(CTkBaseClass): self.function = command self.state = state self.hover = hover - self.check_state = (variable.get() == onvalue) + if variable == None: + self.check_state = False + else: + self.check_state = (variable.get() == onvalue) self.onvalue = onvalue self.offvalue = offvalue self.variable: tkinter.Variable = variable