How to save entry input to variable in tkinter i'm using python 3
You can create a tkinter variable like StringVar
and set it as the textvariable
of your Entry
widget. Then you can access the content by calling the get
method on the variable.
import tkinter as tkroot = tk.Tk()var = tk.StringVar()user_name = tk.Entry(root,textvariable=var)user_name.pack()#var.trace("w",lambda *args: print (var.get()))var.trace("w", lambda *args: pg.typewrite(var.get(), interval=0.2)root.mainloop()