Advertisement
mrFitzpatrick

eventGUI

Jul 30th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 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()
  4.  
  5. #function definitions
  6. def btn_name_clicked():
  7.     info("Greetings", "Hello, " + txt_name.value + " - I hope you\'re having a nice day")
  8.  
  9. def btn_flavour_clicked():
  10.     info("Flavour Confirmation", "I understand that your favourite icr cream flavour is " + txt_flavour.value + "!")
  11.    
  12.  
  13. #GUI
  14. lbl_name = Text(app, text="Hello. What's your name?")
  15. txt_name = TextBox(app)
  16.  
  17. btn_go = PushButton(app, command=btn_name_clicked, text="Done")
  18.  
  19. lbl_flavour = Text(app, text = "Your favourite ice cream flavour?")
  20. txt_flavour = TextBox(app)
  21.  
  22. btn_flavour = PushButton(app, command=btn_flavour_clicked, text="Confirm flavour")
  23.  
  24. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement