Python 为什么可以';我不能用get和Tkinter askstring吗?
我试图使用简单对话框从用户处获取一个值,并将其插入文本区域,但出现以下错误:Python 为什么可以';我不能用get和Tkinter askstring吗?,python,tkinter,Python,Tkinter,我试图使用简单对话框从用户处获取一个值,并将其插入文本区域,但出现以下错误: AttributeError: 'str' object has no attribute 'get 我的代码: def feedialog(): amt_input = tkSimpleDialog.askstring("Amout","Enter Amount") txtarea1.insert(END,f"\n Fee :{amt_input.get(
AttributeError: 'str' object has no attribute 'get
我的代码:
def feedialog():
amt_input = tkSimpleDialog.askstring("Amout","Enter Amount")
txtarea1.insert(END,f"\n Fee :{amt_input.get()}"
您正在对str
对象调用get
方法:amt\u输入已经是一个字符串。您只需使用:
txtarea1.insert(END,f"\n Fee :{amt_input}"
那么,您的意思是:
f“\n费用:{amt\u input}”
?字符串没有get
方法。你想做什么?谢谢我知道了我正在学习使用文本区域生成账单谢谢much@Rahul98135如果您的问题已解决,请将此答案标记为解决您的问题。这对每个人都很清楚。
txtarea1.insert(END,f"\n Fee :{amt_input}"