0

Why I got AttributeError: 'Text' object has no attribute 'trace_variable?

Please Help me.... Here my code: from tkinter import * root=Tk() def retrieve_input(): inputValue=textBox.get("1.0","end-1c") print(inputValue) textBox=Text(root, height=2, width=10) textBox.pack() def limiter(*args): limit = 5 s = textBox.get() if len(s) > limit: textBox.set(s[:limit]) textBox.trace_variable("w",limiter) buttonCommit=Button(root,height=1,width=10,text="Commit",command=lambda:retrieve_input()) buttonCommit.pack() mainloop()

24th May 2018, 6:09 AM
Manish Mehta
Manish Mehta - avatar
1 Antwort
0
there is no trace_variable function in Text. What are you trying to accomplish?
24th May 2018, 8:54 AM
Markus Kaleton
Markus Kaleton - avatar