Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么可以';我不能用get和Tkinter askstring吗?_Python_Tkinter - Fatal编程技术网

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}"