I have made a singup window which saved the data of people in text file and in login window i used a for loop to read thorugh the data and check if the password and username is correct or not but everytime i press login, it only shows incorrect username or password and doesnt open the dashboard window even if the password is correct.
def check():
storefile = open('store.txt','r')
for line in storefile:
if namepasss and nameuser in line:
dashboard()
else:
Label(my, text="Incorrect username or\n password.", fg="red", bg="lightgray").grid(row=4, column=2)
name_useval = StringVar()
name_passval = StringVar()
namepasss = name_passval.get()
nameuser = name_useval.get()
Entry(my, textvariable=name_useval,bg="#e3e2e2", bd=0, highlightthickness=0,).grid(row=2, column=2)
Entry(my, textvariable=name_passval,bg="#e3e2e2", bd=0, highlightthickness=0,).grid(row=3, column=2)
login = Button(my, text="Login", font=("sans serif", 12, ), bg="lightgray", bd=2,
highlightthickness=0, fg="Black", command=check).grid(row=10, column=2)
this is how the data are saved in a text file after users singup in singup window
('randomguy', 'randomguy@gmail.com', '901909210', 'randompassword')
('randomguy2', 'randomguy2@gmail.com', '901978210', 'randompassword2')