calling a function in python upon entry content changing tkinter

Solutions on MaxInterview for calling a function in python upon entry content changing tkinter by the best coders in the world

showing results for - "calling a function in python upon entry content changing tkinter"
Jarrod
02 Jul 2017
1from tkinter import *
2
3root = Tk()
4sv = StringVar()
5
6def callback():
7    print(sv.get())
8    return True
9
10e = Entry(root, textvariable=sv, validate="focusout", validatecommand=callback)
11e.grid()
12e = Entry(root)
13e.grid()
14root.mainloop()
Giacomo
07 May 2020
1from Tkinter import *
2
3def callback(sv):
4    print sv.get()
5
6root = Tk()
7sv = StringVar()
8sv.trace("w", lambda name, index, mode, sv=sv: callback(sv))
9e = Entry(root, textvariable=sv)
10e.pack()
11root.mainloop()  
Moses
29 Jun 2019
1sv.trace_add("write", callback)