когда я прошу его вывести поле ввода в файл, он ничего не делает, и, поскольку я новичок в python, я немного застрял, я знаю, что это простая проблема, но я не уверен как это исправить. Пожалуйста, помогите.
import tkinter as tk
from PIL import ImageTk
window= tk.Tk()
def SignUp ():
text = username_entry.get()
file= open(r"C:/Users/willi/OneDrive/Documents/Scripts/username_info.txt", "w")
file.write(text)
file.close()
username_entry.delete(0, tk.END)
password_entry.delete(0, tk.END)
def createNewWindow():
window1 = tk.Toplevel(window)
canvas= tk.Canvas(window1,width=1920,height=1080)
canvas.create_image(0,0,anchor=tk.NW, image= Main)
canvas.pack()
signup_button=tk.Button(window1,width=23, text="Register!", font="CCDutchCourage2", fg="white", height=1, relief="flat", bg="#183936", command=SignUp)
signup_button.place(x=840, y=665)
username_entry= tk.Entry(window1,width=14, bg="#183936", font=('Ariston Comic Demo Regular', 35), relief="flat")
username_entry.place(x=776, y=447)
password_entry= tk.Entry(window1,width=14, bg="#183936", font=('Ariston Comic Demo Regular', 35), relief="flat")
password_entry.configure(show="*")
password_entry.place(x=776, y=555)
Main= tk.PhotoImage(file= r"C:/Users/willi/Images/Asset 15.png")
canvas= tk.Canvas(window,width=1920,height=1080)
canvas.create_image(0,0,anchor=tk.NW, image= Main)
canvas.pack()
signup_button=tk.Button(window,width=23, text="Sign Up!", font="CCDutchCourage2", fg="white", height=1, relief="flat", bg="#183936", command=createNewWindow)
signup_button.place(x=840, y=665)
username_entry= tk.Entry(window,width=14, bg="#183936", font=('Ariston Comic Demo Regular', 35), relief="flat")
username_entry.place(x=776, y=447)
password_entry= tk.Entry(window,width=14, bg="#183936", font=('Ariston Comic Demo Regular', 35), relief="flat")
password_entry.configure(show="*")
password_entry.place(x=776, y=555)