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='Make a hectic hero', layout='auto')
- # Function of the Hero animal
- def make_hero_name():
- adjective = cmb_adjective.value
- colour = txt_colour.value
- animal = cmb_animal.value
- hero = adjective +" "+ colour +" "+ animal
- if check_animaly.value == 1 :
- side =" You are good on choosing animal"
- if check_animaln.value == 1:
- side =" You are bad on choosing animal"
- lbl_ouput.value = "You are... The " + hero + "\n"+side
- # Widget that use
- 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)
- message4 = Text(app, text='Are animal friendly ?', size=12, font='Arial')
- check_animaly = CheckBox(app, text='Yes')
- check_animaln = CheckBox(app, text='No')
- 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")
- # Display to the screen
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement