Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from guizero import App, Text, PushButton, Combo, TextBox, ButtonGroup, Picture, info, CheckBox
- app = App(title="Super Turbo Heromaker II - Championship Edition")
- def size1():
- app.width = 300
- app.height = 180
- lbl_intro.visible = False
- btn_ok.visible = False
- if chk_darkMode.value == 1:
- app.bg = 23,23,23
- app.text_color = "white"
- else:
- app.bg = 255,50,0
- app.text_colour = "black"
- chk_darkMode.visible = False
- def size2():
- app.width = 300
- app.height = 80
- lbl_adjective.visible = False
- bgp_adjectives.visible = False
- btn_adjective.visible = False
- if chk_darkMode.value == 1:
- app.bg = 23,23,23
- app.text_color = "white"
- else:
- app.bg = 255,150,0
- app.text_colour = "black"
- def size3():
- app.width = 300
- app.height = 250
- lbl_colour.visible = False
- cmb_colour.visible = False
- btn_colour.visible = False
- if chk_darkMode.value == 1:
- app.bg = 23,23,23
- app.text_color = "white"
- else:
- app.bg = 255,200,0
- app.text_colour = "black"
- def make_hero_name():
- 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 + "!"
- #pic_logo = Picture(app, image="superdog.png")
- app.bg = 255,0,0
- app.width = 300
- app.height = 90
- chk_darkMode = CheckBox(app, text="Enable Dark Mode")
- lbl_intro = Text(app, text="Ready to make your new hero?")
- btn_ok = PushButton(app, text="Let's go!", command=size1)
- lbl_adjective = Text(app, text="Choose an adjective")
- bgp_adjectives = ButtonGroup(app, options=["Cheesy","Wobbly","Unfortunate","Slimey","Annoying"])
- btn_adjective = PushButton(app, text="ok", command=size2)
- lbl_colour = Text(app, text="Now choose a colour")
- cmb_colour = Combo(app, options=["Yellow","Pink","Brown","Green"])
- btn_colour = PushButton(app, text="ok", command=size3)
- lbl_animal = Text(app, text="Finally, choose an animal")
- bgp_animal = ButtonGroup(app, options=["Giraffe","Pig","Bear","Lizard"])
- 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