python tkinter save entry data in txt file code example
Example: python tkinter save entry data in txt file
# Save data from entry widget to a text file:
from tkinter import *
def save_data():
name_info = name.get()
f = open("text_file.txt", "w")
f.write(name_info + "\n")
f.close()
root = Tk()
name = StringVar()
Entry(root, textvariable=name).pack()
Button(root, text='Save Data', command=lambda:save_data()).pack()
root.mainloop()