Most of the coding here is standard Python Notebook behavior. There are a few new interactions with the system:
- The handler is registered with the underlying widget system. The system needs to know what code, if any, to invoke when an action occurs.
- When a corresponding action occurs, the system calls upon the cell where the handler is located to invoke the handler.
- In our case, the button handler displays a message. The default location for the message to be displayed is in the same cell as the button control. This means when the button was created, the underlying system recorded which cell it was in. The system then draws upon that cell location to output the handler.
- Finally, the handler adds to the appropriate cell output. ...