我正在嘗試製作一個程序,您在輸入框中鍵入文本,然後當您單擊一個按鈕時它將顯示下面的文本,但它不起作用,只要我點擊按鈕,它給了我一個錯誤?爲什麼不會顯示文字
import sys
from tkinter import *
def myhello():
text = ment.get()
label = Label(text=entry).grid()
return
ment = str()
root = Tk()
root.title('Tutorial')
root.geometry('400x400')
button = Button(root, text='Button',command = myhello).place(x='160', y='5')
entry = Entry(textvariable=ment).place(x='5', y= '10 ')
root.mainloop()
'地方'通常不被使用。你應該學會使用'pack'和'grid' - 它們更加靈活,並且通常會導致具有良好調整行爲的UI。 –