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\nYou like " + txt_biscuit.value + "s apparently!")
- def btn_joke_clicked():
- info("Joke!", "Hey, " + txt_name.value + " what is brown and sticky? A stick!")
- # Your GUI widgets go here
- lbl_name = Text(app, text="Hello. What's your name?")
- txt_name = TextBox(app)
- lbl_biscuit = Text(app, text="What's your favourite biscuit?")
- txt_biscuit = TextBox(app)
- btn_go = PushButton(app, command=btn_go_clicked, text="Done")
- btn_joke = PushButton(app, command=btn_joke_clicked, text="Tell a joke")
- # Show the GUI on the screen
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement