我对tkinter非常陌生,但我喜欢用我的python应用程序拥有gui的能力。我正在为一些低级家庭自动化的监视器应用程序工作,我想显示一些有效的读数会发生变化。
我已经用Google搜索了如何做到这一点但到目前为止没有太多运气。我希望有人可以向我指出如何刷新这些值。
from Tkinter import *
root = Tk()
w1 = Label(root, text="reading1: "+str(readings[0]), justify='left', wraplength=100)
w2 = Label(root, text="reading2: "+str(readings[1]), justify='right', wraplength=100)
w1.pack(side='left')
w2.pack(side='right')
root.title("Test Automation")
root.minsize(800, 400)
root.mainloop()
代码还有其他内容,但我不相信这个例子是必要的。就像我说的,如果读数[0]发生变化,我怎么能在gui中反映出来?