Advertisement
Guest User

Untitled

a guest
Mar 26th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. from guizero import App, Text, ButtonGroup, Combo, PushButton, TextBox, CheckBox
  2. app = App(title = "Hero-o-matic", width = 300)
  3.  
  4. def make_hero_name():
  5.     adjective = cmb_adjective.value
  6.     colour = txt_colour.value
  7.     animal = cmb_animal.value
  8.     check =  check1.value
  9.     hero = adjective + " " + colour + " " + animal + " " + str(check)
  10.     lbl_output.value = "You are... The " + hero + "."
  11.  
  12. message1 = Text(app, text = "Choose an adjective")
  13. cmb_adjective = Combo(app, options=["Amazing", "Bonny", "Charming", "Delightful", "Funny"])
  14.  
  15. message2 = Text(app, text = "Enter a colour?")
  16. txt_colour = TextBox(app)
  17.  
  18. message3 = Text(app, text = "Pick an animal?")
  19. cmb_animal = Combo(app, options = ["Aardvark", "Badger", "Cat", "Dophin", "Velociraptor", "Dog"])
  20.  
  21. check1 = CheckBox(app, text = "Check 1")
  22.  
  23. btn_make_name = PushButton(app, text = "Make me a hero", command = make_hero_name)
  24.  
  25. lbl_output = Text(app, text = "A hero name will appear here")
  26.  
  27. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement