Advertisement
mrFitzpatrick

Animal Hero Maker with BOXES

Aug 16th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.41 KB | None | 0 0
  1. #Colour scheme courtesy of color.adobe.com
  2.  
  3. from guizero import App, Text, PushButton, Combo, TextBox, ButtonGroup, Box, info, CheckBox
  4.  
  5. app = App(title="Super Turbo Heromaker III - Combo Edition")
  6.  
  7.  
  8. def size1():
  9.     app.width = 300
  10.     app.height = 230
  11.    
  12.     lbl_intro.visible = False
  13.     btn_ok.visible = False
  14.     lbl_done_1 = Text(box_1, text="Part 1 completed")
  15.    
  16. def size2():
  17.     app.width = 300
  18.     app.height = 150
  19.    
  20.     lbl_adjective.visible = False
  21.     bgp_adjectives.visible = False
  22.     btn_adjective.visible = False
  23.     lbl_done_2 = Text(box_2, text="Part 2 completed")
  24.    
  25.  
  26. def size3():
  27.     app.width = 300
  28.     app.height = 250
  29.    
  30.     lbl_colour.visible = False
  31.     cmb_colour.visible = False
  32.     btn_colour.visible = False
  33.     lbl_done_3 = Text(box_3, text="Part 3 completed")
  34.  
  35. def size4():
  36.     app.width = 300
  37.     app.height = 250
  38.    
  39.  
  40. def make_hero_name():
  41.     lbl_animal.visible = False
  42.     bgp_animal.visible = False
  43.     lbl_done_4 = Text(box_4, text="Part 4 completed")
  44.     app.width = 500
  45.     adjective = bgp_adjectives.value
  46.     colour = cmb_colour.value
  47.     animal = bgp_animal.value
  48.     hero_name = adjective + " " + colour + " " + animal
  49.     lbl_output.text_color = cmb_colour.value
  50.     lbl_output.text_size = 20
  51.     lbl_output.value = "Behold, the " + hero_name + "!"
  52.  
  53. app.bg = "#B36937"
  54. app.width = 300
  55. app.height = 70
  56. box_1 = Box(app, border=4)
  57. box_1.bg = "#69F7FF"
  58.  
  59. lbl_intro = Text(box_1, text="Ready to make your new hero?")
  60. btn_ok = PushButton(box_1, text="Let's go!", command=size1)
  61.  
  62. box_2 = Box(app, border=4)
  63. box_2.bg = "#25ABB3"
  64. lbl_adjective = Text(box_2, text="Choose an adjective")
  65. bgp_adjectives = ButtonGroup(box_2, options=["Cheesy","Wobbly","Unfortunate","Slimey","Annoying"])
  66. btn_adjective = PushButton(box_2, text="ok", command=size2)
  67.  
  68. box_3 = Box(app, border=4)
  69. box_3.bg = "#FFA569"
  70. lbl_colour = Text(box_3, text="Now choose a colour")
  71. cmb_colour = Combo(box_3, options=["Yellow","Pink","Brown","Green"])
  72. btn_colour = PushButton(box_3, text="ok", command=size3)
  73.  
  74. box_4 = Box(app, border=4)
  75. box_4.bg = "#FFDF82"
  76. lbl_animal = Text(box_4, text="Finally, choose an animal")
  77. bgp_animal = ButtonGroup(box_4, options=["Giraffe","Pig","Bear","Lizard"], command=size4)
  78.  
  79. btn_generate_name = PushButton(app, text="Make me a hero!", command=make_hero_name)
  80. lbl_output = Text(app, text="A hero name will appear here")
  81.  
  82.  
  83.  
  84. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement