I would like to know what each of the commands after lambda in this line of code is for and its purpose. It doesn't make sense to me on why its there:
sv.trace("w", lambda name, index, mode, sv=sv: self.NameLimit(sv))
I have got the validation to work how i want but don't know what name, index, mode, sv=sv is for.
I have to understand it to use it in my code as that is very important. I don't need a super detailed explanation (although it would be ok) but just an overview of what each lambda argument does. Thanks :)
Example code with this in use:
from tkinter import *
from tkinter import ttk
import random
def main():
pass
if __name__ == '__main__':
main()
def callback(sv):
c = sv.get()[0:9]
print ("c=", c)
sv.set(c)
root = Tk()
sv = StringVar()
sv.trace("w", lambda name, index, mode, sv=sv: callback(sv))
e = Entry(root, textvariable=sv)
e.pack()
root.mainloop()