From the course: Python Data Visualization: Create Impactful Visuals, Animations, and Dashboards by Pearson

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Widget customization

Widget customization

As we saw, Interact and InteractManual automatically generate all the widgets necessary for any function that we decorated it or that we pass as the argument for their function versions. Of course, we can also manually instantiate any of the widgets that we want. You can find all the widget objects inside the APIWidgets module, and you can instantiate them directly. This gives us a lot more flexibility in controlling them, how they function and how they are displayed. Here we have a simple example where we're instantiating an integer slider, where we're defining the default value, so value equals 18, the range of values, so the minimum and the maximum, the step, so essentially how much does the value increment every time we move the slider, also the description, so this is essentially the label that gets displayed next to it instead of the argument name, as is done by default with interact and interact manual. Also, we can enable it or disable it. So here we're setting disable equals…

Contents