crzcas

eventgui

Feb 27th, 2021
78
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 for your events go here.
  6. def btn_go_clicked():
  7.     info("Greetings","Hello, " + txt_name.value + ", your favourite animal is " + txt1_name.value + ", and your favourite sport is " + txt2_name.value + ". Have a nice day.")
  8.  
  9. # Your GUI widgets go here
  10. lbl_name = Text(app, text="Hello. What's your name?")
  11. txt_name = TextBox(app)
  12.  
  13. lbl1_name = Text(app, text="What is your favourite animal?")
  14. txt1_name = TextBox(app)
  15.  
  16. lbl2_name = Text(app, text="What is your favourite sport?")
  17. txt2_name = TextBox(app)
  18.  
  19. btn_go = PushButton(app, command=btn_go_clicked, text="Done")
  20.  
  21. # Show the GUI on the screen
  22. app.display()
Add Comment
Please, Sign In to add comment