我有一個名爲「Username」的條目。Python Tkinter - 如何使用entry.get()輸入來自條目的輸入
username = Entry()
username.place(x = 10, y = 50)
和一個提交按鈕
submit = Button(text="Submit", command=getInfo)
submit.place(x = 150, y = 48)
它調用的getInfo功能
def getInfo():
user = username.get()
我想將用戶作爲標籤。我可以很好地打印它,文本顯示在控制檯中。當我嘗試放置時,出現錯誤。
File "tk.py", line 8, in getInfo
user.place(x = 150, y = 90)
AttributeError: 'str' object has no attribute 'place'