We learned about the Button widget of Matplotlib in the previous chapter, but Slider is a new widget that we will learn here. However, the objective of this recipe is to demonstrate how a Matplotlib widget application can be used across GUI frameworks without any code changes, by just changing the backend. We will also use the same polar plot across all the GUI frameworks, so that we can see the difference in the way they work, rather than getting lost in the details of the plot itself!
We will use the Slider to determine the number of leaves to be plotted in the polar plot. Each time the Slider is dragged, the value of the Slider is taken to plot that many leaves in the plot.
We will use the Quit Button to exit the application by closing the figure and window objects.