Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from guizero import App, Text, ButtonGroup, Combo, PushButton, TextBox
- app = App(title="Hero-o-matic")
- def make_hero_name():
- adjective = bgp_adjective.value
- colour = txt_colour.value
- animal = cmb_animal.value
- hero = adjective + " " + colour + " " + animal
- lbl_output.value = "You are... The " + hero + "."
- message1 = Text(app, text="Choose an animal")
- bgp_adjective = ButtonGroup(app, options=["Aardvark", "Badger", "Cat", "Dolphin", "Velociraptor","Cow", "Goat", "Shark", "Tiger", "T-Rax"], selected="Dolphin")
- message2 = Text(app, text="Enter a colour?")
- txt_colour = TextBox(app)
- message3 = Text(app, text="Pick an adjective")
- cmb_animal = Combo(app, options=["Amazing", "Bonny", "Charming", "Delightful","Happy", "Sad", "Joyfull", "Annonying"], selected="Happy", width=20)
- btn_make_name = PushButton(app, text='Make me a hero', command=make_hero_name)
- lbl_output = Text(app, text="A hero name will appear here")
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement