Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Colour scheme courtesy of color.adobe.com
- from guizero import App, Text, PushButton, Combo, TextBox, ButtonGroup, Box, info, CheckBox
- app = App(title="Super Turbo Heromaker III - Combo Edition")
- def size1():
- app.width = 300
- app.height = 230
- lbl_intro.visible = False
- btn_ok.visible = False
- lbl_done_1 = Text(box_1, text="Part 1 completed")
- def size2():
- app.width = 300
- app.height = 150
- lbl_adjective.visible = False
- bgp_adjectives.visible = False
- btn_adjective.visible = False
- lbl_done_2 = Text(box_2, text="Part 2 completed")
- def size3():
- app.width = 300
- app.height = 250
- lbl_colour.visible = False
- cmb_colour.visible = False
- btn_colour.visible = False
- lbl_done_3 = Text(box_3, text="Part 3 completed")
- def size4():
- app.width = 300
- app.height = 250
- def make_hero_name():
- lbl_animal.visible = False
- bgp_animal.visible = False
- lbl_done_4 = Text(box_4, text="Part 4 completed")
- app.width = 500
- adjective = bgp_adjectives.value
- colour = cmb_colour.value
- animal = bgp_animal.value
- hero_name = adjective + " " + colour + " " + animal
- lbl_output.text_color = cmb_colour.value
- lbl_output.text_size = 20
- lbl_output.value = "Behold, the " + hero_name + "!"
- app.bg = "#B36937"
- app.width = 300
- app.height = 70
- box_1 = Box(app, border=4)
- box_1.bg = "#69F7FF"
- lbl_intro = Text(box_1, text="Ready to make your new hero?")
- btn_ok = PushButton(box_1, text="Let's go!", command=size1)
- box_2 = Box(app, border=4)
- box_2.bg = "#25ABB3"
- lbl_adjective = Text(box_2, text="Choose an adjective")
- bgp_adjectives = ButtonGroup(box_2, options=["Cheesy","Wobbly","Unfortunate","Slimey","Annoying"])
- btn_adjective = PushButton(box_2, text="ok", command=size2)
- box_3 = Box(app, border=4)
- box_3.bg = "#FFA569"
- lbl_colour = Text(box_3, text="Now choose a colour")
- cmb_colour = Combo(box_3, options=["Yellow","Pink","Brown","Green"])
- btn_colour = PushButton(box_3, text="ok", command=size3)
- box_4 = Box(app, border=4)
- box_4.bg = "#FFDF82"
- lbl_animal = Text(box_4, text="Finally, choose an animal")
- bgp_animal = ButtonGroup(box_4, options=["Giraffe","Pig","Bear","Lizard"], command=size4)
- btn_generate_name = PushButton(app, text="Make me a hero!", command=make_hero_name)
- lbl_output = Text(app, text="A hero name will appear here")
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement