I'm working on a project involving username and password input boxes that both have to be a certain phrase in order for the user to get to the next stage of the program. Currently, when the PushButton is pressed, regardless of whether the correct username and password are typed, the user will always get the "Sorry, your username or password is incorrect" infobox instead of the successful one.
My program so far is below. Please ignore the passed variable, it's important for something later, and all the blank texts are to force other widgets into the correct places.
from guizero import App, Text, TextBox, PushButton, info, Picture
passed = False
def authenticate():
if input_box1 == "a" and input_box2 == "b":
passed = True
info("Welcome", "Level 5 identification accepted. Welcome, Dr. Artyom.")
else:
info("Password", "Your username or password is incorrect.")
app = App(title="AppTest", width=900, height=600, layout="grid", bg=[255,255,255])
text = Text(app, text=" ", grid=[0,0])
text = Text(app, text=" ", grid=[1,1])
text = Text(app, text="Please enter a valid username and password.", grid=[2,1], color=[0,0,0])
text = Text(app, text=" ", grid=[2,2])
input_box1 = TextBox(app, grid=[2,3], height=1, width=25)
text = Text(app, text="Username", grid=[1,3], color=[0,0,0])
text = Text(app, text=" ", grid=[2,4])
input_box2 = TextBox(app, grid=[2,5], hide_text=True, height=1, width=25)
text = Text(app, text="Password", grid=[1,5], color=[0,0,0])
text = Text(app, text=" ", grid=[2,6])
submit = PushButton(app, enabled=True, command=authenticate, height=1, width=6, grid=[2,7])
text = Text(app, text="Submit", grid=[2,7], color=[0,0,0])
text = Text(app, text=" ", grid = [3,11])
picture = Picture(app, image="D:\python files\logtext.gif", grid=[2,12])
app.display()
I know it's a bit of a mess, but all help is greatly appreciated.