Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from guizero import App, Text, ButtonGroup, Combo, PushButton, TextBox, CheckBox
- app = App(title = "Hero-o-matic", width = 300)
- def make_hero_name():
- adjective = cmb_adjective.value
- colour = txt_colour.value
- animal = cmb_animal.value
- check = check1.value
- hero = adjective + " " + colour + " " + animal + " " + str(check)
- lbl_output.value = "You are... The " + hero + "."
- message1 = Text(app, text = "Choose an adjective")
- cmb_adjective = Combo(app, options=["Amazing", "Bonny", "Charming", "Delightful", "Funny"])
- message2 = Text(app, text = "Enter a colour?")
- txt_colour = TextBox(app)
- message3 = Text(app, text = "Pick an animal?")
- cmb_animal = Combo(app, options = ["Aardvark", "Badger", "Cat", "Dophin", "Velociraptor", "Dog"])
- check1 = CheckBox(app, text = "Check 1")
- 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