Advertisement
kingshuk2018

Untitled

Nov 19th, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. from guizero import App, Text, ButtonGroup, Combo, PushButton, TextBox
  2. app = App(title="Hero-o-matic")
  3.  
  4. def make_hero_name():
  5. adjective = bgp_adjective.value
  6. colour = txt_colour.value
  7. animal = cmb_animal.value
  8. hero = adjective + " " + colour + " " + animal
  9. lbl_output.value = "You are... The " + hero + "."
  10.  
  11. message1 = Text(app, text="Choose an animal")
  12. bgp_adjective = ButtonGroup(app, options=["Aardvark", "Badger", "Cat", "Dolphin", "Velociraptor","Cow", "Goat", "Shark", "Tiger", "T-Rax"], selected="Dolphin")
  13.  
  14. message2 = Text(app, text="Enter a colour?")
  15. txt_colour = TextBox(app)
  16.  
  17. message3 = Text(app, text="Pick an adjective")
  18. cmb_animal = Combo(app, options=["Amazing", "Bonny", "Charming", "Delightful","Happy", "Sad", "Joyfull", "Annonying"], selected="Happy", width=20)
  19.  
  20. btn_make_name = PushButton(app, text='Make me a hero', command=make_hero_name)
  21.  
  22. lbl_output = Text(app, text="A hero name will appear here")
  23.  
  24. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement