Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from guizero import App, Text, ButtonGroup, Combo, PushButton, TextBox, Box
- app = App(title='Make a hectic hero', layout='auto', bg='yellow')
- # 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', color='blue')
- 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', color='green')
- 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)
- box = Box(app)
- btn_make_name = PushButton(box, text='Make me a hero', command=make_hero_name)
- lbl_ouput = Text(box, text="A hero name will appear here", color='blue')
- lbl_ouput.font = 'Verdana'
- box.bg = "gray"
- box.text_size = 16
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement