Outputting text to file Tkinter Outputting text to file Tkinter tkinter tkinter

Outputting text to file Tkinter


You are mistaken. Your program does indeed store a value in the username_info.txt file.

The problem is, you got two variables named username_entry. One is global (defined at the end of the script) and one is local (defined in createNewWindow()). SignUp() accesses the globally defined one. This corresponds to the first tk.Entry element in the first window. If you leave this element empty and only type in the user name in the second window, nothing will be stored.

Also, you missed the line tk.mainloop() in your posted example. :)