1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| import Tkinter as tk
def validator(value1, value2, log):
text = "entree 1 : %s - entree 2 : %s"%(value1.get(), value2.get())
log["text"] = text
win = tk.Tk()
my_value1 = tk.StringVar()
entry1 = tk.Entry(win, textvariable=my_value1)
entry1.grid()
my_value2 = tk.StringVar()
entry2 = tk.Entry(win, textvariable=my_value2)
entry2.grid()
log = tk.Label(win, width=80)
log.grid()
button = tk.Button(win, text="voir les valeurs", command=lambda value1=my_value1, value2 = my_value2, output=log:validator(value1, value2, log))
button.grid()
win.mainloop() |
Partager