Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from guizero import App, ButtonGroup, CheckBox, Combo, info, PushButton, Text
- app = App(title="Hero name generator")
- def btn_go_clicked():
- if checkbox.value == 1:
- name = "Your SUPER hero name"
- else:
- name = "Your hero name"
- info(name, bg_adjective.value + " " + combo_color.value + " " + combo_animal.value)
- lbl_adjective = Text(app, text="Choose an adjective...")
- bg_adjective = ButtonGroup(app, options=["Busy", "Crazy", "Crying", "Funny", "Happy", "Lazy", "Powerful"], selected="Powerful")
- lbl_color = Text(app, text="Enter a color...")
- combo_color = Combo(app, options=["Black", "Blue", "Green", "Red", "Pink", "Yellow", "Violet"], selected="Pink")
- lbl_animal = Text(app, text="Pick an animal...")
- combo_animal = Combo(app, options=["Bear", "Deer", "Hamster", "Panther", "Skunk", "Snake"], selected="Hamster")
- checkbox = CheckBox(app, text="Add SUPER to hero to name")
- btn_go = PushButton(app, command=btn_go_clicked, text="Generate hero name")
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment