Black Lives Matter. Please consider donating to Black Girls Code today.

Want to create a dropdown which contain a filtered value depening on another dropdown

i have a dropdown like:
dcc.Dropdown(
id=‘conti’,
options=[
{‘label’: ‘Africa’, ‘value’: ‘Africa’},
{‘label’: ‘Asia’, ‘value’: ‘Asia’},
{‘label’: ‘Europe’, ‘value’: ‘Europe’},
{‘label’: ‘Americas’, ‘value’: ‘Americas’},
{‘label’: ‘Oceania’, ‘value’: ‘Oceania’}
],
multi=False,
value=“Asia”
)
now a want to create a another dropdown which take value from 1st dropdown lets say “ASIA” and filter only ASIAN country.
In “options” of dropdown is it not possible to give lists instead of hardcoding each and every country??

Right now i am harcoding it like:
dcc.Dropdown(
id=‘country1’,
options=[
{‘label’: ‘Afghanistan’, ‘value’: ‘Afghanistan’},
{‘label’: ‘Albania’, ‘value’: ‘Albania’},
{‘label’: ‘Zimbabwe’, ‘value’: ‘Zimbabwe’},
{‘label’: ‘Yemen’, ‘value’: ‘Yemen’},
{‘label’: ‘Zambia’, ‘value’: ‘Zambia’}
],
multi=False
)

@akuma307 - Check out the last example with “cities” and “countries” in this tutorial https://plot.ly/dash/getting-started-part-2

i tried that, but i am unable to get any values in dropdown, can u please point out where i am doing wrong?

app.layout=html.Div([
dcc.Graph(id=‘Graph-with-slider’),
html.Hr(),
dcc.Graph(id=‘Graph-with-slider1’),
dcc.Slider(
id=‘year-slider’,
min=df[‘year’].min(),
max=df[‘year’].max(),
value=df[‘year’].min(),
step=None,
marks = {str(year) : str(year) for year in df[‘year’].unique()}
),
dcc.Dropdown(
id=‘conti’,
options=[
{‘label’: ‘Africa’, ‘value’: ‘Africa’},
{‘label’: ‘Asia’, ‘value’: ‘Asia’},
{‘label’: ‘Europe’, ‘value’: ‘Europe’},
{‘label’: ‘Americas’, ‘value’: ‘Americas’},
{‘label’: ‘Oceania’, ‘value’: ‘Oceania’}
],
multi=False,
),
dcc.Dropdown( id=‘country1’)
])

@app.callback(
dash.dependencies.Output(‘country1’,‘options’),
[dash.dependencies.Input(‘conti’,‘value’)])
def select_cities(selected_conti):
t=df.loc[df[‘continent’]==‘selected_conti’]
z=t.country.unique()
print(z)
return[{‘label’:i,‘value’:i} for i in z]