from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx as NavigationToolbar from matplotlib.figure import Figure
self.add_toolbar() # comment this out for no toolbar
defadd_toolbar(self): self.toolbar = NavigationToolbar(self.canvas) self.toolbar.Realize() # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) # update the axes menu on the toolbar self.toolbar.update()
# alternatively you could use #class App(wx.App): classApp(WIT.InspectableApp): defOnInit(self): 'Create the main window and insert the custom frame' self.Init() frame = CanvasFrame() frame.Show(True)