无论我对我的复选按钮做什么,它似乎都没有设置变量。以下是所涉及的代码部分:
class Window:
def __init__(self):
self.manualb = 0 #to set the default value to 0
def setscreen(self):
#screen and other buttons and stuff set here but thats all working fine
manual = tkr.Checkbutton(master=self.root, variable=self.manualb, command=self.setMan, onvalue=0, offvalue=1) #tried with and without onvalue/offvalue, made no difference
manual.grid(row=1, column=6)
def setMan(self):
print(self.manualb)
#does some other unrelated stuff
Run Code Online (Sandbox Code Playgroud)
它只是一直打印 0。我做错了什么吗?没有其他任何东西可以手动操作。