Created
March 3, 2022 14:03
-
-
Save techzeero/9e100c4755ff2d9626530d15da6cc939 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dash import Dash, dcc, html, Input, Output | |
app = Dash() | |
app.layout = html.Div([ | |
dcc.Dropdown( | |
options=[{'label': 'India', 'value': 'India'}, | |
{'label': 'Russia', 'value': 'Russia'}, | |
{'label': 'USA', 'value': 'USA'}], # Data to be shown in dropdown options | |
value='India', # Dropdown Default Value | |
id='dropdown1' # Dropdown id | |
), | |
html.Div(id='output-container') | |
]) | |
@app.callback(Output('output-container', 'children'), | |
Input('dropdown1', 'value')) | |
def update_output(value): | |
return f'You have selected {value}' | |
if __name__ == '__main__': | |
app.run_server() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment