Advertisement
jolgri

Assignment2

Dec 9th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 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("","Your name is " + txt_name.value + " and you like "+ txt_animal.value + ".")
  8. def btn_go2_clicked():
  9. info("","Your name is " + txt_name.value + ". You like "+ txt_animal.value +", but you dislike " + txt_animaldis.value + ".")
  10.  
  11.  
  12. # Your GUI widgets go here
  13. lbl_name = Text(app, text="What's your name?")
  14. txt_name = TextBox(app)
  15. lbl_animal = Text(app, text=" What animals do you like the most?")
  16. txt_animal = TextBox(app)
  17. btn_go = PushButton(app, command=btn_go_clicked, text="Done")
  18. lbl_animaldis = Text(app, text=" What animals do you dislike the most?")
  19. txt_animaldis = TextBox(app)
  20. btn_go2 = PushButton(app, command=btn_go2_clicked, text="Add information")
  21.  
  22. # Show the GUI on the screen
  23. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement