maroph

heroname.py

Dec 6th, 2019
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. from guizero import App, ButtonGroup, CheckBox, Combo, info, PushButton, Text
  2.  
  3. app = App(title="Hero name generator")
  4.  
  5.  
  6. def btn_go_clicked():
  7.     if checkbox.value == 1:
  8.         name = "Your SUPER hero name"
  9.     else:
  10.         name = "Your hero name"
  11.     info(name, bg_adjective.value + " " + combo_color.value + " " + combo_animal.value)
  12.  
  13.  
  14. lbl_adjective = Text(app, text="Choose an adjective...")
  15. bg_adjective = ButtonGroup(app, options=["Busy", "Crazy", "Crying", "Funny", "Happy", "Lazy", "Powerful"], selected="Powerful")
  16.  
  17. lbl_color = Text(app, text="Enter a color...")
  18. combo_color = Combo(app, options=["Black", "Blue", "Green", "Red", "Pink", "Yellow", "Violet"], selected="Pink")
  19.  
  20. lbl_animal = Text(app, text="Pick an animal...")
  21. combo_animal = Combo(app, options=["Bear", "Deer", "Hamster", "Panther", "Skunk", "Snake"], selected="Hamster")
  22.  
  23. checkbox = CheckBox(app, text="Add SUPER to hero to name")
  24.  
  25. btn_go = PushButton(app, command=btn_go_clicked, text="Generate hero name")
  26.  
  27. app.display()
Advertisement
Add Comment
Please, Sign In to add comment