Widget basics

All widgets work the same, generally:

  • You create or define an instance of a widget.
  • You can preset attributes of a widget, such as its initial value or a label to be displayed.
  • Widgets can react to different inputs from a user. The inputs are gathered by a handler or a Python function that is invoked when a user performs some action on a widget; for example, a function could be set up to call the handler if the user clicks on a button.
  • The value of a widget can be used later in your script in the same way as any other variable; for example, you could use a widget to determine how many circles to draw.

Get Learning Jupyter now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.