1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| import Tkinter
T1_RELOAD_VALUE = 123
T1_PERIOD_VALUE = 10
T2_RELOAD_VALUE = 40
T2_PERIOD_VALUE = 60
def T1_interrupt():
value = t1.get()
if value == 0:
t1.set(T1_RELOAD_VALUE)
else:
t1.set(value-1)
root.after(T1_PERIOD_VALUE, T1_interrupt)
def T2_interrupt():
value = t2.get()
if value == 0:
t2.set(T2_RELOAD_VALUE)
else:
t2.set(value-1)
root.after(T2_PERIOD_VALUE, T2_interrupt)
root = Tkinter.Tk()
t1 = Tkinter.IntVar(value=T1_RELOAD_VALUE)
t2 = Tkinter.IntVar(value=T2_RELOAD_VALUE)
Tkinter.Label(root, textvariable=t1, width=20).grid()
Tkinter.Label(root, textvariable=t2, width=20).grid()
T1_interrupt()
T2_interrupt()
root.mainloop() |
Partager