Event loops in matplotlib
In the chapter on matplotlib architecture, we mentioned the event loops that the GUI toolkits use and which are integrated with matplotlib. As you dig through the matplotlib libraries, you will eventually come across several mentions with regard to the event loops that are not from the GUI toolkits. So that we can better understand the difference between these and, more importantly, the event handling and user interaction with plots, we're going to spend some time learning more about these event loops in matplotlib.
Event-based systems
In general, event loops are part of a recurring set of patterns that are used together in various computing frameworks. Often, they comprise of the following:
- An incoming event
- A mechanism that is used to respond to an event
- A looping construct (for example, the while loop, listener, and the message dispatch mechanism)
Event-based systems are typically asynchronous in nature, allowing events to be sent to the system and then responded...