Python 运行程序时出现类型错误。无法将条目存储为整数

Python 运行程序时出现类型错误。无法将条目存储为整数,python,python-3.x,Python,Python 3.x,所以,我试图制作一个程序,它接受你输入的骰子数量(最多5个),然后生成随机的骰子数。但是,当我运行此代码时: diceAmount = Entry(root) diceAmount.grid(row=1) diceAmountint = int(diceAmount) 我一直收到以下错误消息: int() argument must be a string, a bytes-like object or a number, not 'Entry' 我在网上的任何地方都找不到使用tkinter

所以,我试图制作一个程序,它接受你输入的骰子数量(最多5个),然后生成随机的骰子数。但是,当我运行此代码时:

diceAmount = Entry(root)
diceAmount.grid(row=1)
diceAmountint = int(diceAmount)
我一直收到以下错误消息:

int() argument must be a string, a bytes-like object or a number, not 'Entry'

我在网上的任何地方都找不到使用tkinter条目显示该错误消息的其他人

int()函数不知道如何将Entry对象转换为int值。您需要从Entry对象的某些属性或方法中提供一个字符串、字节或数值,并将其传递到int(…)调用。

如果没有看到
Entry的代码,就无法回答。但这里有一个提示:除非某个任意类有一个返回int的
\uu int\uu
方法,否则不能将其转换为整数。