how to save and display values entered in these user input containers
from dash import html, Dash, dcc, Input, Output, State,dash_table,ALL
app = dash.Dash()
Model-wide constants
MAX_ = 16
InputStyle = {“padding”: “20px”}
Scenarios = dict([(“Scenario {}”.format(n), n) for n in range(1, MAX_ + 1)])
slots =
for S in range(1, 13): slots.append(" ".join(["Slot ", str(S)]))
app = dash.Dash()
app.layout = html.Div([
html.H1(“Back Testing”),
html.Div([html.Label(“How many Scenarios are there?”),
dcc.Input(id=“UserInput”,
placeholder=“# of Scenarios”,
value=2,
type=“number”,
min=1,
max=MAX_)]),
html.Hr(),
html.H1("Enter Scenario Parameters"),
html.Div(
id="Scenario_Input_Box",
children=[
html.Div(
id="PI_{}_container".format(i),
children=[
"Scenario {}: ".format(i),
dcc.Input(
id="PI_{}".format(i),
placeholder="Enter Parameters",
type="text"),
]) for i in range(1, MAX_ + 1)]),
html.Div(html.H1("Here are Scenarios")),
html.Div(id="input-vals"),
# Planning to have hidden div to store data
])
Defining visibility of Player [name] Inputs (PI’s)
for n in range(1, MAX_ + 1):
@app.callback(Output(“PI_{}_container”.format(n), “style”),
[Input(“UserInput”, “value”)])
def callback(players, n=n):
NewStyle = {**InputStyle}
if n <= players:
NewStyle[“display”] = “block”
else:
NewStyle[“display”] = “none”
return NewStyle
if name == ‘main’:
app.run_server(debug=False)