Hi!
I’m trying to update the value of a dcc.Input component as the result of a callback, but I’m unable to make it work.
A simplified example that reproduces my issue:
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
# App init
app = dash.Dash(__name__)
# Layout
app.layout = html.Div(children=[
dcc.Input(
id='test-input',
type='text'
),
dcc.Slider(
id='test-slider',
min=0,
max=10,
value=5
)
])
@app.callback(Output('test-input', 'value'),
[Input('test-slider', 'value')])
def update_input(slider_value):
print('Slider value: {}'.format(slider_value))
return slider_value
if __name__ == '__main__':
app.run_server(debug=True)
Is there something wrong with my code? Or is not possible to have a dcc.Input value as the output of a callback?
Thanks