【发布时间】:2015-02-16 01:06:18
【问题描述】:
我正在使用 Tkinter 制作一个 GUI,它允许在其中一个窗口中输入数据:
enterscore = Entry(window4, font="Helvatica 25", textvariable = newscore).pack()
我正在尝试制作一个按钮,它将输入的数据保存为变量:
savebttn = Button(window4, text= "Save", width=5, height=2, font="Helvatica 25", command = savescore).pack()
地点:
def savescore():
score = enterscore.get()
但是,如果我运行程序,它会返回错误消息:
AttributeError: 'NoneType' object has no attribute 'get'
我哪里错了?
【问题讨论】:
-
对不起,我没有意识到这是重复的,因为我不明白问题出在哪里!
标签: python python-3.x tkinter nonetype