Here is the explanation for the preceding code:
- app = wx.App() initiates the wxPython GUI application.
- window = wx.Frame(None, -1, "Embedding with wxPython") defines and instantiates the window object in which the figure will be displayed:
- None specifies that the window is the parent object
- -1 specifies the window identification number
- "Embedding with wxPython" specifies the label for the window that will appear on top of the window
- fig = Figure(figsize=(6, 5), dpi=100) defines and instantiates the figure
- canvas = FigureCanvas(window, -1, fig) defines the canvas connecting the figure and packing it into the window
- toolbar = NavigationToolbar2WxAgg(canvas) defines the toolbar and packs it into the canvas
- Step 4 defines ...