Generate widgets for function arguments
This guide addresses how to generate widgets for function arguments with Panel interact
.
First, let's declare a simple function that just returns the arguments:
Next, let's call interact
with the function and it's arguments. The values of the arguments will be inspected to infer an appropriate set of widgets to autogenerate. After running the code block, changing any of the resulting widgets will cause the function to be re-run, updating the displayed output.
We can also explicitly pass a widget as one of the values:
Alternatively, this interact
approach can be used as a decorator:
Let's put this all together: