I created a checkbox that will be used to enable/disable its corresponding entry.
b1var = IntVar(value=1)
b1 = Checkbutton(bevmenu, command=lambda: check(), text="Latte", variable=b1var, onvalue=1, offvalue=0).grid(row=0, column=0, sticky="w")
b1a = Entry(bevmenu, bd=2, textvariable=b1v, state=DISABLED).grid(row=0, column=1, sticky="w")
Here's the function that will perform the enabling/disabling of the entry:
def check():
if b1var.get() == 1:
b1a.config(state=NORMAL)
elif b1var.get() == 0:
I tried running the program and not only that it doesn't work, it also gives this output error when I try to check/uncheck.
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\__\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1884, in __call__
return self.func(*args)
File "C:\Users\__\PycharmProjects\CafeManagementSystem\main.py", line 96, in <lambda>
b1 = Checkbutton(bevmenu, command=lambda: check(), text="Latte", variable=b1var, onvalue=1, offvalue=0)
File "C:\Users\__\PycharmProjects\CafeManagementSystem\main.py", line 23, in check
b1a.config(state=DISABLED)
AttributeError: 'NoneType' object has no attribute 'config'