所以基本上当我在两个输入框中输入信息时,我希望数据进入一个可以在其他页面上访问的文本文件,但目前我需要帮助来定义我正在编码的功能。如果您提供帮助,请注意需要添加一个名为“学生”的新页面(最好是记事本)。从#function 开始,代码有点乱,def adduser(): 之后的下一行代码不正确。
from tkinter import*
window = Tk()
window.title("Spelling Bee Opener")
window.geometry("600x400+500+250")
window.configure(bg="yellow")
label = Label(window,text = "Please Enter Your new Username and Password in the boxes below")
label.configure(bg='yellow')
label.place(x= 50, y=25)
Student=[]
#Username Entry
label = Label(window, text="Username")
label.configure(bg='Yellow')
label.place(x=50, y=70)
entry_box1=Entry(window,)
entry_box1.place(x=110,y=70)
#Password Entry
label = Label(window, text="Password")
label.configure(bg='Yellow')
label.place(x=50, y=100)
entry_box2=Entry(window,)
entry_box2.place(x=110, y=100)
# Function
def adduser():
addstudent = open ("student.txt", "w")
addstudent.write()
window.destroy()
b = Button(window, borderwidth=2, text="Add New user", width=12, pady=5, command=adduser)
b.place(x=110,y=125)
window.mainloop()