我正在写一个程序,它从一个文件中读取数据,并相应地调整设置。这就是我创建checkbutton的方式:
should_auto = BooleanVar()
autodetect = Checkbutton(root, text="Autodetect", var=should_auto, onvalue = True, offvalue = False, command=toggle_delay)
autodetect.grid(row=0, column=2, padx=7, pady=5, sticky=W)
然后,我尝试使用以下方法“检查”它:
autodetect.select()
但这将返回以下错误:
Traceback (most recent call last):
File "C:\Users\CedBook\Documents\GitHub\live-image-desktop-background\src\GUI.py", line 110, in <module>
autodetect.select()
AttributeError: 'Checkbutton' object has no attribute 'select'
我已经尝试过使用autodetect.set(True)
,但是后来我得到了几乎相同的错误,但是Checkbutton object has no attribute 'set'
我在effbot.org上看到了.select(),但也许这不是针对python 3的?
目前没有回答
相关问题 更多 >
编程相关推荐