Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Import the GUI widgets that you'll be using, and create the 'app' for your program.
- from guizero import App, TextBox, PushButton, Text, info
- app = App()
- # Function definitions for your events go here.
- def btn_go_clicked():
- info("Greetings","Hello, " + txt_name.value + " - I hope you're having a nice day. " +txt_pet.value + " is a nice name for a pet :)")
- def btn_cat_clicked():
- info("Message", "Nice. Cats are very playful! ")
- def btn_dog_clicked():
- info("Message","Lovely! Dogs are faithful animals :) ")
- def btn_other_clicked():
- info("Message", "Wow...Now I'm curious...")
- # Your GUI widgets go here
- lbl_name = Text(app, text="Hello. What's your name?")
- txt_name = TextBox(app)
- lbl_pet = Text(app, text="What's your pet's name?")
- txt_pet = TextBox(app)
- btn_go = PushButton(app, command=btn_go_clicked, text="Done")
- lbl_pet = Text(app, text="Is your pet a cat, dog or other animal?")
- btn_cat =PushButton(app, command=btn_cat_clicked, text="Cat")
- btn_dog =PushButton(app, command=btn_dog_clicked, text="Dog")
- btn_other =PushButton(app, command=btn_other_clicked, text="Other")
- # Show the GUI on the screen
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement