August 2018
Beginner
282 pages
5h 51m
English
We can also use the interact function to produce a drop-down listbox for the user to select from. In the following script we produce a dropdown with two choices:
from ipywidgets import interact
def myfunction(x):
return x
interact(myfunction, x=['red','green']);
This script will do the following:
If we run this script in a Notebook, we get the following display:

The preceding screenshot ...
Read now
Unlock full access