#n is appropriate, but make a suitable FOOS as shown below and
#By creating a list as STATES,@app.You can replace it with the State in the callback.
#You can also create an Input this way.
n = 5
FOOS = ['foo' + str(i) for i in range(n)]
STATES = [State(foo, 'value') for foo in FOOS]
@app.callback(
Output('plot', 'children'),
[Input('button', 'n_clicks')],
STATES)
def update_contents(clicks, *args):
print("click_num:{}".format(clicks))
foo_args = args[0:len(FOOS) - 1]
return foo_args[0]
@app.callback(
Output('plot', 'children'),
[Input('button', 'n_clicks')],
[State('foo1','value'),State('foo2','value'),State('foo3','value'),State('foo4','value'),State('foo5','value')]
def update_contents(clicks, *args):
print("click_num:{}".format(clicks))
foo_args = args[0:len(FOOS) - 1]
return foo_args[0]
Recommended Posts