# check out https://dash.plotly.com/ for documentation
# And check out https://py.cafe/maartenbreddels for more examples
from dash import Dash, Input, Output, callback, dcc, html, set_props, ctx
import time
app = Dash(__name__)
md = """
# Dash demo
See [The dash examples index](https://dash-example-index.herokuapp.com/) for more examples.
"""
test = 10
test_components = [html.Div([html.Div(id='testout'+str(x)),
dcc.Interval(id='testing'+str(x), interval=30+(10*x))]) for x in range(test)]
# Define the layout of the Dash app
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),
html.Div(children='Dash: A web application framework for Python.'),
html.Button('Testing', id='test'),
*test_components
])
for x in range(test):
@app.callback(
Output('testout'+str(x),'children'),
Input('test','n_clicks'),
Input(f'testing'+str(x), 'n_intervals')
)
def rawr(n_clicks: int, n_interval: int):
time.sleep(4/x)
return ctx.triggered[0]['value']