Hi,
I want to create a number of checkboxes based on an an input slider, but I stumble upon an “Error loading layout”. When I replace my Checkboxes for RadioItems, it works perfectly, so I don’t really know what I should do anymore.
Sample of my code (I hope this formats correctly):
app = dash.Dash()
app.layout = html.Div([
dcc.Slider( id='n_clusters', min=0, max=10, step=1, marks=[{'label': i, 'value': i} for i in range(0,10)], value=5, ), html.Hr(), dcc.Checklist(id='selected_clusters')
])
@app.callback(
Output(‘selected_clusters’, ‘options’),
[Input(‘n_clusters’, ‘value’)])def display_checkboxes(clusters):
return[{‘label’: i, ‘value’: i} for i in range(clusters)]if name == ‘main’:
app.run_server()
I can’t wrap my head around why this works perfectly when I change Checklist to RadioItems… Thanks in advance if you can help me!
Edit: tried to fix some layout in my code… Didn’t really work.