Advertisement
mrFitzpatrick

HeroMaker_ExtraTextLabel

Aug 16th, 2019
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.54 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.     box_extra1 = Box (app, border=10, width="fill")
  53.     box_extra1.bg = "#D75FD9"
  54.     lbl_extra1 = Text(box_extra1, text="Hello World!")
  55.  
  56. app.bg = "#B36937"
  57. app.width = 300
  58. app.height = 70
  59. box_1 = Box(app, border=4)
  60. box_1.bg = "#69F7FF"
  61.  
  62. lbl_intro = Text(box_1, text="Ready to make your new hero?")
  63. btn_ok = PushButton(box_1, text="Let's go!", command=size1)
  64.  
  65. box_2 = Box(app, border=4)
  66. box_2.bg = "#25ABB3"
  67. lbl_adjective = Text(box_2, text="Choose an adjective")
  68. bgp_adjectives = ButtonGroup(box_2, options=["Cheesy","Wobbly","Unfortunate","Slimey","Annoying"])
  69. btn_adjective = PushButton(box_2, text="ok", command=size2)
  70.  
  71. box_3 = Box(app, border=4)
  72. box_3.bg = "#FFA569"
  73. lbl_colour = Text(box_3, text="Now choose a colour")
  74. cmb_colour = Combo(box_3, options=["Yellow","Pink","Brown","Green"])
  75. btn_colour = PushButton(box_3, text="ok", command=size3)
  76.  
  77. box_4 = Box(app, border=4)
  78. box_4.bg = "#FFDF82"
  79. lbl_animal = Text(box_4, text="Finally, choose an animal")
  80. bgp_animal = ButtonGroup(box_4, options=["Giraffe","Pig","Bear","Lizard"], command=size4)
  81.  
  82. btn_generate_name = PushButton(app, text="Make me a hero!", command=make_hero_name)
  83. lbl_output = Text(app, text="A hero name will appear here")
  84.  
  85.  
  86.  
  87. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement