Example #1
0
    def add_toolbar(self):

        #Set up Matplotlib Toolbar
        self.chart_toolbar = wxb.NavigationToolbar2Wx(self.canvas)
        tw, th = self.chart_toolbar.GetSizeTuple()
        fw, fh = self.canvas.GetSizeTuple()
        self.chart_toolbar.SetSize(wx.Size(fw, th))
        self.chart_toolbar.Realize()

        self.sizer.Add(
            self.chart_toolbar, 1,
            wx.ALIGN_CENTER | wx.TOP | wx.SYSTEM_MENU | wx.CLOSE_BOX)
        self.sizer.Add(self.canvas, 20, wx.LEFT | wx.BOTTOM | wx.GROW)

        self.SetSizer(self.sizer)
        self.chart_toolbar.update()
        self.canvas.Update()
        self.canvas.Refresh()
        self.Update()
Example #2
0
 def add_mpl_toolbar(self):
     self.toolbar = backend_wx.NavigationToolbar2Wx(self.canvas)
     self.toolbar.Realize()
     if 0:  # wx.Platform == '__WXMAC__':
         # Mac platform (OSX 10.3, MacPython) does not seem to cope with
         # having a toolbar in a sizer. This work-around gets the buttons
         # back, but at the expense of having the toolbar at the top
         self.SetToolBar(self.toolbar)
     else:
         # On Windows platform, default window size is incorrect, so set
         # toolbar width to figure width.
         tw, th = self.toolbar.GetSizeTuple()
         fw, fh = self.canvas.GetSizeTuple()
         # By adding toolbar in sizer, we are able to put it at the bottom
         # of the frame - so appearance is closer to GTK version.
         # As noted above, doesn't work for Mac.
         self.toolbar.SetSize(wx.Size(fw, th))
         self.Sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
     # update the axes menu on the toolbar
     self.toolbar.update()