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='Make a hectic hero', layout='auto')
- # Function
- def make_hero_name():
- adjective = cmb_adjective.value
- colour = txt_colour.value
- animal = cmb_animal.value
- hero = adjective +" "+ colour +" "+ animal
- lbl_ouput.value = "You are... The " + hero + "."
- message1 = Text(app, text='Choose an adjective...', size=12, font='Arial')
- cmb_adjective = Combo(app, options=["Amazing", "Bony", "Outgoing", "Funky, Bravely", "Strong"],selected="Amazing", width=15)
- message2 = Text(app, text='Enter a color', size=12, font='Arial')
- txt_colour = TextBox(app)
- message3 = Text(app, text='Pick an animal', size=12, font='Arial')
- cmb_animal = Combo(app, options=["Aardvark", "Cat", "Dolphin", "Dog", "Tiger", "Velocipraptor"], selected="Aardvark", width=20)
- btn_make_name = PushButton(app, text='Make me a hero', command=make_hero_name)
- lbl_ouput = Text(app, text="A hero name will appear here")
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement