Dash inputs and outputs
The next step is to determine which component is going to become an input (to our pure Python function) and which component will get the return value of the function (as an output) to be displayed to the user.
Determining your inputs and outputs
The dash.dependencies
module has several classes, two of which we will be using here: Output
and Input
.
These classes can be imported by adding the following line to the imports
section of our app:
from dash.dependencies import Output, Input
Let's quickly recap what we did earlier before adding the final element that will make this functionality work:
- We instantiated an app in the Jupyter Notebook environment.
- We created a dropdown containing three colors.
- We created a regular function that returns a string, together with the value provided to it:
'Your selected' + <color>
. - The components were identified with descriptive names through their
id
parameters. Input...