When I click on the button it should print the id of the label inside that card only. But it always prints the id of last label no matter which button I click on.
In the code below my_grid is the name of the grid in which I'm trying to populate the cards and listcards is the list of cards labels that I'm trying to put inside the card
Code
with my_grid:
for i in range(0,len(listcards)):
with ui.card() as mycard:
label_card = ui.label(text=f"{listcards[i]}")
bt = ui.button("ID", on_click=lambda:print(label_card.id))
When I click on the button I want to print the label id of that card only but it always prints the id of last label. I really want to fix this issue. Any suggestions?