Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from guizero import App, Text, PushButton, Combo, TextBox, ButtonGroup
- app = App(title="Heromaker 1.0", width=400)
- def make_hero_name():
- adjective = bgp_adjectives.value
- colour = cmb_colour.value
- animal = bgp_animal.value
- hero_name = adjective + " " + colour + " " + animal
- lbl_output.value = "Behold, the " + hero_name + "!"
- lbl_adjective = Text(app, text="Choose an adjective")
- bgp_adjectives = ButtonGroup(app, options=["Cheesy","Wobbly","Unfortunate","Slimey","Annoying"])
- lbl_colour = Text(app, text="Now choose a colour")
- cmb_colour = Combo(app, options=["Yellow","Pink","Brown","Green"])
- lbl_animal = Text(app, text="Finally, choose an animal")
- bgp_animal = ButtonGroup(app, options=["Giraffe","Pig","Bear","Lizard"])
- btn_generate_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