bensimmo

Untitled

Feb 1st, 2021
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.80 KB | None | 0 0
  1. # Import the GUI widgets that you'll be using, and create the 'app' for your program.
  2. from guizero import App, TextBox, PushButton, Text, info
  3. app = App(visible = False)
  4. app2 = App(title = "Password check")
  5.  
  6. # Function definitions for your events go here.
  7. def btn_go_clicked1():
  8.     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?")
  9.  
  10. def btn_go_clicked2():
  11.     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}?")
  12.  
  13. def btn_go_pass1():
  14.     lbl_pass2.visible = True
  15.     txt_pass2.visible = True
  16.     btn_passcheck2.visible = True    
  17.    
  18. def btn_go_pass2():
  19.     if txt_pass1.value == txt_pass2.value:
  20.         info(f"Granted", "You are now logged in")
  21.         app.visible = True
  22.         app2.visible = False
  23.     else:
  24.         info(f"Denied", "Your passwords do not match")
  25.  
  26. # Your GUI widgets go here (app2)
  27. lbl_pass1 = Text(app2, text="What is your password?")
  28. txt_pass1 = TextBox(app2)
  29. btn_passcheck1 = PushButton(app2, command=btn_go_pass1, text="ok")
  30. lbl_pass2 = Text(app2, text="Please enter it again", visible = False)
  31. txt_pass2 = TextBox(app2, visible = False)
  32. btn_passcheck2 = PushButton(app2, command=btn_go_pass2, text="Check", visible = False)
  33.  
  34. # Your GUI widgets go here (app)
  35. lbl_name = Text(app, text="Hello. What's your name?")
  36. txt_name = TextBox(app)
  37. lbl_pet = Text(app, text="What is your pets name?")
  38. txt_pet = TextBox(app)
  39. lbl_food = Text(app, text="and you favourite food")
  40. txt_food = TextBox(app)
  41.  
  42. btn_go1 = PushButton(app, command=btn_go_clicked1, text="Done")
  43. btn_go2 = PushButton(app, command=btn_go_clicked2, text="Now what?")
  44.  
  45. # Show the GUI on the screen
  46. app2.display()
  47. app.display()
  48.  
Add Comment
Please, Sign In to add comment