# | Likes | Tech tags | Title | Creator | Created date |
---|---|---|---|---|---|
1 | 0 |
ipywidgets
Jupyter
|
2023-01-29 22:03
|
Creates a dropdown widget using the @interact
decorator and prints a value based on the choice in that widget. The cell is automatically recomputed when a new value is chosen.
[1]:
from ipywidgets import interact
[2]:
@interact(x=['Alice', 'Bob', 'Caroline'])
def function(x):
print("Hello", x)
functions | ||
interact |
ipywidgets.readthedocs.io | github.com |
print |
docs.python.org |
Create a dropdown widget in your notebook and make it so that the output of a cell is recomputed based on the chosen value in the widget