You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importdashfromdash.dependenciesimportInput, Output, Stateimportdash_html_componentsashtmlimportdash_core_componentsasdccapp=dash.Dash()
app.layout=html.Div([
html.Button('Click Me', id='button'),
html.H3(id='button-clicks'),
html.Hr(),
html.Label('Input 1'),
dcc.Input(id='input-1'),
html.Label('Input 2'),
dcc.Input(id='input-2'),
html.Label('Slider 1'),
dcc.Slider(id='slider-1'),
html.Button(id='button-2'),
html.Div(id='output')
])
@app.callback(Output('button-clicks', 'children'), [Input('button', 'n_clicks')])defclicks(n_clicks):
return'Button has been clicked {} times'.format(n_clicks)
@app.callback(Output('output', 'children'), [Input('button-2', 'n_clicks')],state=[State('input-1', 'value'),State('input-2', 'value'),State('slider-1', 'value')])defcompute(n_clicks, input1, input2, slider1):
return'A computation based off of {}, {}, and {}'.format(
input1, input2, slider1
)
if__name__=='__main__':
app.run_server(debug=True)
I.e., instead of Input to trigger the callback, the second callback uses form values from States.
The thing which makes this relatively hard is that the callback inputs are created when initializing the app, so I would think this needs to be a static configuration option not a dynamic switch.
On some occasions, if the fit takes very long, users might want to change several parameters before initiating a new fit.
Also, probably rather relevant for meta-configs, some combinations for meta parameters might not be valid (for example
x_min > x_max
).To counter running fits in such scenarios @walkloud suggest to include a "stop fit" switch which, when enabled, delays until disabled again.
The text was updated successfully, but these errors were encountered: