Here is what would happen if you followed my suggestion:
Coded (used Aimped for initial):
import dash
from dash import html, Input, Output, callback_context
import numpy as np
import dash_bootstrap_components as dbc
# raw input
cards = ['2s', '3s', '4s', '5s', '6s', '7s', '8s', '9s', 'Ts', 'Js', 'Qs', 'Ks', 'As',
'2h', '3h', '4h', '5h', '6h', '7h', '8h', '9h', 'Th', 'Jh', 'Qh', 'Kh', 'Ah',
'2d', '3d', '4d', '5d', '6d', '7d', '8d', '9d', 'Td', 'Jd', 'Qd', 'Kd', 'Ad',
'2c', '3c', '4c', '5c', '6c', '7c', '8c', '9c', 'Tc', 'Jc', 'Qc', 'Kc', 'Ac']
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
app.layout = html.Div([html.Div(i, id=i, n_clicks=0, className='myCustomCard') for i in cards] +
[html.Div(id='output')], id='myCardHolder')
@app.callback(
Output('output', 'children'),
[
Input(card_name, 'n_clicks')
for card_name in cards
],
prevent_initial_call=True
)
def update(*args):
trigger = callback_context.triggered_id
return f'you clicked button {trigger}'
if __name__ == '__main__':
app.run(debug=True)