我有一个程序需要更改小部件的状态,但问题是我不断收到此错误:
Traceback (most recent call last):
File "C:\Users\Public\Documents\Programming\Spellox\Spellox.py", line 67, in <module>
new_word()
File "C:\Users\Public\Documents\Programming\Spellox\Spellox.py", line 37, in new_word
entry['state'] = DISABLED
TypeError: 'NoneType' object does not support item assignment
任何人都可以帮助这里是我的条目小部件的代码:
from tkinter import *
import time
root = Tk()
entry = Entry(root, fg='blue', textvariable=check_var).pack(side=TOP)
def change():
time.sleep(3)
entry['state'] = DISABLED
change()
root.mainloop()
提前致谢!