I just want to ask if it is Possible to link an class with an action to an item
i have my Item class
Code: Select all
class Item(object):
def __init__ (self, name, weight, actions=[]):
self.name = name
self.weight = weight
self.actions = []
Code: Select all
screen inventory_screen():
modal False
hbox align (.5,.01) spacing 20:
textbutton "Close Inventory" action [ Hide("inventory_screen"), Show("inventory_button"),]
frame:
background Solid ("#00000090")
align (1.0, 0.5)
side "c r":
area (0, 0, 320, 1080)
viewport id "vp":
draggable True
vbox:
for item in backpack.inventory:
textbutton ("[item.item.name], [item.amount]") action [item.item.actions]
vbar value YScrollValue("vp")
Code: Select all
paper = Item('Paper', 1, actions=['item_choice_2'])
Code: Select all
menu item_choice_2:
"Bye":
"Bye"
"Hi":
"Hallo"
i can click on my item but nothing happen :/
Would be great if someone had a solution xD
Thanks :3
Karlo