我有一個輸入框,當我在其中輸入一些文本並單擊按鈕時,文本應該出現在標籤中。如何將輸入框的內容傳遞給標籤?
我寫了下面的內容,但我無法將輸入框的內容綁定到標籤上。
from Tkinter import *
root = Tk()
e = Entry(root)
e.pack()
def get_me():
e.get()
print e.get()
#e.delete(0, END)
bn = Button(root, text = "Click me", command = get_me)
bn.pack()
la = Label(root, font = "verdana 15 italic bold", width = 20, bg = "BLUE", fg = "RED", text = get_me)
la.pack()
mainloop()
你也可以使用'configure'方法來獲得相同的結果:'la.configure(text =「text」)' –