Advertisement
Mori007

NewFaceGui

Feb 7th, 2021
1,220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | None | 0 0
  1. from guizero import App, Text, ButtonGroup, Combo, PushButton, TextBox, Box
  2.  
  3. app = App(title='Make a hectic hero', layout='auto', bg='yellow')
  4.  
  5. # Function
  6. def make_hero_name():
  7.     adjective = cmb_adjective.value
  8.     colour = txt_colour.value
  9.     animal = cmb_animal.value
  10.     hero = adjective +" "+ colour +" "+ animal
  11.     lbl_ouput.value = "You are... The " + hero + "."
  12.  
  13. message1 = Text(app, text='Choose an adjective...', size=12, font='Arial', color='blue')
  14. cmb_adjective = Combo(app, options=["Amazing", "Bony", "Outgoing", "Funky, Bravely", "Strong"],selected="Amazing", width=15)
  15.  
  16. message2 = Text(app, text='Enter a color', size=12, font='Arial', color='green')
  17. txt_colour = TextBox(app)
  18. message3 = Text(app, text='Pick an animal', size=12, font='Arial')
  19. cmb_animal = Combo(app, options=["Aardvark", "Cat", "Dolphin", "Dog", "Tiger", "Velocipraptor"], selected="Aardvark", width=20)
  20.  
  21. box = Box(app)
  22.  
  23. btn_make_name = PushButton(box, text='Make me a hero', command=make_hero_name)
  24. lbl_ouput = Text(box, text="A hero name will appear here", color='blue')
  25. lbl_ouput.font = 'Verdana'
  26.  
  27. box.bg = "gray"
  28. box.text_size = 16
  29.  
  30. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement