I am trying to use the
app.layout[' ... '].value
to return a value.
My code is as follows:
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.config.supress_callback_exceptions = True
app.layout = html.Div([
dcc.Input(
id='datasource',
value=0,
type="number"
),
html.Div(id='Value_Display'),
])
@app.callback(
Output('Value_Display', 'children'),
[Input('datasource', 'value')])
def display_controls(datasource_value):
print(app.layout['datasource'].value)
return datasource_value
if __name__ == '__main__':
app.run_server(debug=True)
One can see that the value gets updated correctly becasue one can see that the
return datasource_value
does properly update. However it can be seen that the value that
return datasource_value
and
app.layout['datasource'].value
are different
I am probably either using app.layout[‘datasource’].value wrong or have complelty misunderstood its function.
Any help would be much appreciated, many thanks