Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Import the GUI widgets that you'll be using, and create the 'app' for your program.
- from guizero import App, TextBox, PushButton, Text, info
- app = App(visible = False)
- app2 = App(title = "Password check")
- # Function definitions for your events go here.
- def btn_go_clicked1():
- info(f"Greetings",f"Hello, {txt_name.value} - I hope you're having a nice day.\n I see you love {txt_food.value}, does {txt_pet.value} like it too?")
- def btn_go_clicked2():
- info(f" ¯\_(ツ)_/¯",f"Have you fed {txt_pet.value} today {txt_name.value}? \n Did {txt_pet.value} try to pinch your {txt_food.value}?")
- def btn_go_pass1():
- lbl_pass2.visible = True
- txt_pass2.visible = True
- btn_passcheck2.visible = True
- def btn_go_pass2():
- if txt_pass1.value == txt_pass2.value:
- info(f"Granted", "You are now logged in")
- app.visible = True
- app2.visible = False
- else:
- info(f"Denied", "Your passwords do not match")
- # Your GUI widgets go here (app2)
- lbl_pass1 = Text(app2, text="What is your password?")
- txt_pass1 = TextBox(app2)
- btn_passcheck1 = PushButton(app2, command=btn_go_pass1, text="ok")
- lbl_pass2 = Text(app2, text="Please enter it again", visible = False)
- txt_pass2 = TextBox(app2, visible = False)
- btn_passcheck2 = PushButton(app2, command=btn_go_pass2, text="Check", visible = False)
- # Your GUI widgets go here (app)
- lbl_name = Text(app, text="Hello. What's your name?")
- txt_name = TextBox(app)
- lbl_pet = Text(app, text="What is your pets name?")
- txt_pet = TextBox(app)
- lbl_food = Text(app, text="and you favourite food")
- txt_food = TextBox(app)
- btn_go1 = PushButton(app, command=btn_go_clicked1, text="Done")
- btn_go2 = PushButton(app, command=btn_go_clicked2, text="Now what?")
- # Show the GUI on the screen
- app2.display()
- app.display()
Add Comment
Please, Sign In to add comment