Reputation: 3
So basically when i enter information into the two entry boxes, i want the data to go into a text file which can be accessed on other pages, but at the moment i need help to define the function i'm coding. If you do help, note that a new page (notepad preferably) needs to be added called "student". from #function onwards the code is abit messy and the code on the next line after def adduser(): is incorrect.
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()
Upvotes: 0
Views: 2004