In this section, we present the basic components11.1 A guiding example to widgets of a widget and their counterparts in Python. We do this by using the guiding example displayed in the following figure:
Figure 11.1: A widget to display
 for user-given frequencies 


In this figure, we see a slider bar at the top. With the use of a computer mouse, the blue bar can be moved from left to right and the value for , ranging between 1 and 5, is displayed on the right of the bar.
Correspondingly, the frequency of the sine wave displayed in the plot window changes.
This widget consists of three parts:
- A figure object with an axes object and the plot
- An axes object containing a slider object
- A call-back function for updating the plot as soon as the slider value changes
We discussed how to program the first part, in Section 6.2: Working with Matplotlib objects directly.
In the following code snippet, we first create a figure with a given size and...