for loop and lists
Posted: Tue Feb 13, 2018 7:09 pm
I'm using the following code to create imagebuttons:
It includes all the objects from the list deck to the list allies....
I wanted to include just the object that was clicked by the user.
So it generates 5 buttons and I wanted to include in the list allies, just the one that was clicked.
Not sure how I'd do that.
Code: Select all
screen test1:
grid 5 1:
xalign 0.7
yalign 0.9
spacing 20
for i in deck:
imagebutton idle i.picture:
hover i.picture2
action allies.append(i), Return("fight")
for i in range (len(deck), 5):
text Null()
I wanted to include just the object that was clicked by the user.
So it generates 5 buttons and I wanted to include in the list allies, just the one that was clicked.
Not sure how I'd do that.