So I am trying to make a basic program that when someone enters data into an Entry box, it checks to see if it matches data in a text file. This is the code that I have but whenever I press the button to activate the function nothing happens, no error, nothing. I have been searching online and in stackoverflow all night long, please help. :(
if login_form is 1:
frame_2.destroy()
label_2 = Label(frame_1, text="Username")
label_3 = Label(frame_1, text="Password")
label_1 = Label(frame_1, text="Name")
svalue = StringVar()
svalue_1 = StringVar()
svalue_2 = StringVar()
entry_1 = Entry(frame_1, textvariable=svalue)
entry_2 = Entry(frame_1, textvariable=svalue_1)
entry_3 = Entry(frame_1, textvariable=svalue_2)
label_1.grid(row=0, sticky=E)
label_2.grid(row=1, sticky=E)
label_3.grid(row=2, sticky=E)
entry_1.grid(row=0, column=1)
entry_2.grid(row=1, column=1)
entry_3.grid(row=2, column=1)
def check():
directory = r'C:\Users\Ethan\Desktop\PycharmProjects\Learning\UserList\%s' % svalue.get()
os.chdir(directory)
fr = open(svalue.get(), 'r')
text = fr.readlines()
username = svalue_1.get()
password = svalue_2.get()
if username is text[0] and password is text[1]:
print("...")
else:
print("...")
button_1 = Button(text="Login", fg="blue", command=check)
button_1.grid(row=3, columnspan=2)