2
我正在使用Tkinter在GUI上工作。我正在嘗試動態更新消息框的內容。下面是我的代碼Tkinter使用按鈕和方法動態更改標籤
高清makeDisplay():
def updateEntry():
#phonelist[0]
v = StringVar()
v.set("additinalText")
def makeWindow() :
global v
win = Tk()
frame1 = Frame(win)
frame1.pack()
Label(frame1, text= "text argument here").grid(row = 0, column = 0, sticky = W)
msg = Message(frame1, textvariable = updateEntry)
msg.config(bg = "lightgreen", font = ('times', 24, 'italic'))
msg.grid(row = 1, column = 0, sticky= W)
frame2 = Frame(win)
frame2.pack()
b1 = Button(frame2, text= " Update ", command = updateEntry)
b1.pack(side = LEFT)
return win
win = makeWindow()
win.mainloop()
makeDisplay()
此刻,我可以設置郵件一次,或將其留空,但不知道我缺少動態地改變它。 感謝