Advertisement
mrFitzpatrick

RandomAnimalMaker

Aug 1st, 2019
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. from guizero import App, Text, PushButton, Combo, TextBox, ButtonGroup
  2.  
  3. app = App(title="Heromaker 1.0", width=400)
  4.  
  5. def make_hero_name():
  6.     adjective = bgp_adjectives.value
  7.     colour = cmb_colour.value
  8.     animal = bgp_animal.value
  9.     hero_name = adjective + " " + colour + " " + animal
  10.     lbl_output.value = "Behold, the " + hero_name + "!"
  11.    
  12. lbl_adjective = Text(app, text="Choose an adjective")
  13. bgp_adjectives = ButtonGroup(app, options=["Cheesy","Wobbly","Unfortunate","Slimey","Annoying"])
  14.  
  15. lbl_colour = Text(app, text="Now choose a colour")
  16. cmb_colour = Combo(app, options=["Yellow","Pink","Brown","Green"])
  17.  
  18. lbl_animal = Text(app, text="Finally, choose an animal")
  19. bgp_animal = ButtonGroup(app, options=["Giraffe","Pig","Bear","Lizard"])
  20.  
  21. btn_generate_name = PushButton(app, text="Make me a hero!", command=make_hero_name)
  22. lbl_output = Text(app, text="A hero name will appear here")
  23.  
  24.  
  25.  
  26. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement