Hello, I am working on a project that analyzes text spoken by characters in a tv show. One part of the project involves letting the user select two characters to compare dialogues. I want to have a list of characters to select from for the first character and the second character.
Here is some example code of the dashboard layout:
#Import libraries
import pandas as pd
import numpy as np
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output, State
#Set parameter
choose_character = ['Mark', 'Mike', 'Derrick', 'Jane', 'Stephanie', 'Lisa']
#Define app layout
app = dash.Dash()
server = app.server
app.layout = html.Div([
dbc.Row([
dbc.Col(
dcc.Dropdown(
id='dropdown1',
options=[{'label': i, 'value': i} for i in choose_character],
value=choose_character[0]
), width=6
),
dbc.Col(
dcc.Dropdown(
id='dropdown2',
options=[{'label': i, 'value': i} for i in choose_character],
value=choose_character[1]
), width=6
)
])
])
if __name__=='__main__':
app.run_server()
What I want to be able to do is to have the selected item from the first dropdown menu not be available in the second dropdown menu. I imagine I need to set up a dictionary with all of the character names and then set up a chained callback like the one here in this link: Part 3. Basic Callbacks | Dash for Python Documentation | Plotly
Am I on the right path? Does anyone know of an easy way to get this done? Any help would be appreciated! Thank you!