zhongnaomi

gui learning 2

Jan 1st, 2020
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 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","Your name is " + txt1_name.value + " - and you like  " + animal_name.value)
  8.  
  9. # Your GUI widgets go here
  10. lbl_name = Text(app, text="Hello. What's your name?")
  11. txt1_name = TextBox(app)
  12. lbl2_name =Text(app, text="Hello. which animal do you like the best?")
  13. animal_name =TextBox(app)
  14. btn_go = PushButton(app, command=btn_go_clicked, text="Done")
  15.  
  16. # Show the GUI on the screen
  17. app.display()
Add Comment
Please, Sign In to add comment