Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from guizero import App, Text, PushButton, Combo, TextBox, ButtonGroup
- app = App(title="Crafter v1.0", width=400)
- def make_item():
- adjective = bgp_adjectives.value
- material = bgp_material.value
- item = bgp_item.value
- item_name = adjective + " " + material + " " + item
- lbl_output.value = "You were gifted a " + item_name + "!"
- if material == "Wooden":
- app.bg = "Brown"
- elif material == "Stone":
- app.bg = "Grey"
- elif material == "Iron":
- app.bg = "Silver"
- elif material == "Gold":
- app.bg = "Gold"
- else:
- app.bg = "Lightblue"
- lbl_adjective = Text(app, text="Choose an adjective")
- bgp_adjectives = Combo(app, options=["Normal","Enchanted","Poisoned","Damaged"])
- lbl_material = Text(app, text="Now choose a material")
- bgp_material = ButtonGroup(app, options=["Wooden","Stone","Iron","Gold","Diamond"])
- lbl_item = Text(app, text="Finally, choose an item")
- bgp_item = ButtonGroup(app, options=["Sword","Axe","Bow","Pickaxe","Shovel"])
- btn_generate_name = PushButton(app, text="Reveal my new item", command=make_item)
- lbl_output = Text(app, text="Your new item will appear here!")
- app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement