how to save text into a txt file using python 2.7 using tk
The simplest way is to create a function that is called when the save button is clicked. Put it near the top of your script and then set it as the button's command
.
def save(): text = e.get() + " " + e1.get() + "\n" with open("text.txt", "a") as f: f.write(text)# Snipb = Button(toolbar, text="save", width=9, command=save)