Event Functions

Every GUI object listens for mouse clicks, mouse drags, typing a key, etc.  This allows you to specify a callback function.

Callback functions are functions to be called when a user action occurs.

You do not have to specify a callback function for everything – only for what you want.  For example, you can have a display, which – when clicked – a circle is drawn, and – when spacebar is pressed – all circles are removed.

The following event functions are available for all GUI library objects (except menus).

Note:  In the case of overlapping objects (e.g., a label and display), user events are handled by the object on top (last added).