I am new in dash and my question might be straight forward.
I have noticed that the callback for the slider will not work when I drag the slider until I unclick the slider.
if you are familiar with javascript this is like the “click” event (as in slider.addEventListener(“click”,()=>{ …});), but I want it to behave like the “input” event.
I have attached a screenshot to show what I mean. please note that my curser is not showing in the screenshot because the program I am using does not show the cursor and I don’t know how to change the setting.
and here is the code:
from dash import dcc, html, Input, Output, Dash
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
dcc.Slider(0, 10, 1.0,
value=5,
id='my-slider'
),
html.Div(id='slider-output-container')
])
@app.callback(
Output('slider-output-container', 'children'),
Input('my-slider', 'value'))
def update_output(value):
return 'You have selected "{}"'.format(value)
if __name__ == '__main__':
app.run_server(debug=True)