Hi! you can create html.Div and with callback update its children property which would return dcc.Slider that was bild by your dropdown logic. if you want your slider can be used in other callbacks then you need to set ‘app.config.supress_callback_exceptions = True’ as you will create slider dynamically. here it is example what im talking about
app.config.supress_callback_exceptions = True
...
html.Div(id='slider-keeper', style={'width': '100%'}),
html.P(id='slider_info')
...
@app.callback(
dash.dependencies.Output('slider-keeper','children'),
[dash.dependencies.Input('your_drop','value')
])
def update_slider_example(some_input):
#your logic there
if some_input==<your condition>:
max_value=3
min_value=0
value=2
marks=[0,1,2,3]
else:
max_value=10
min_value=0
value=5
marks=[0,1,2,3,4,5,6,7,8,9,10]
return dcc.Slider(
id='slider',
min=min_value,
max=max_value,
value=value,
marks=marks
)
@app.callback(
dash.dependencies.Output('slider_info','children'),
[dash.dependencies.Input('slider','value')
])
def update_slider_info(slider_value):
return 'you have select {}'.format(slider_value)