Hi, I’m totally stuck, i have read the docs on callbacks multiple times and watched various youtube videos. Although i understand it, putting into practice is extremely confusing.
I have a dictionary (which throws up an error - apparently its not closed) what i am trying to do is when the user selects a drop down, it populates a box with a key value associated with the state.
My first problem is the dictionary, I’m not sure why it has this error, and I’m unsure how to create a second input that will output the key from the dictionaries. Any help would be great. Thanks
from dash import Dash, dcc, html, Input, Output
app = Dash(__name__)
app.layout = html.Div([
dcc.Dropdown({'NYC': 56'MTL' 88 'SF': 34}, 'NYC', id='demo-dropdown'),
html.Div(id='dd-output-container'
)])
@app.callback(
Output('dd-output-container', 'children'),
Input('demo-dropdown', 'value'),
)
def update_output(value):
return f'You have selected {value}'
if __name__ == '__main__':
app.run_server(debug=True)