I have simple code like this:
from tkinter import *
def _show_value(*pargs):
print(*pargs)
root = Tk()
entry_var1 = StringVar()
entry_var1.trace('w', _show_value)
entry_var2 = StringVar()
entry_var2.trace('w', _show_value)
e1 = Entry(root, textvariable=entry_var1)
e1.pack()
e2 = Entry(root, textvariable=entry_var2)
e2.pack()
root.mainloop()
I want to print content of e1 and e2 on the fly, each time they are written. But instead of text, I get:
PY_VAR0 w
PY_VAR0 w
PY_VAR1 w
PY_VAR1 w
How to get text from e1 based on PY_VAR0, and when text from e2 when PY_VAR1 appears? Is this some internal names of entry_var1 and entry_var2? How do I reference entry_var1 and entry_var2 using PY_VAR0 and PY_VAR1?