Hi,
I didn’t get the way to embed a plot where I wish it to be, for example inside a panel or a sizer?
I did the following :
I create a panel panel_4 which is where I’d like to get the plot, I create a sizer sizer_8 in it and try to load the plot but the plot does not show. I don’t know how to solve this ?
In the init of the frame I put this :
class MyFrame(wx.Frame):
def init(self, *args, **kwds):
…
self.panel_4 = wx.Panel(self.panel_1, -1)
#matplotlib part initialisation
self.fig
= Figure((6,6), 75)
self.canvas = FigureCanvasWx(self.panel_4, -1, self.fig)
self.toolbar = NavigationToolbar2Wx(self.canvas)
self.toolbar.Realize()
# Create a figure manager to manage things
self.figmgr = FigureManager(self.canvas, 1, self)
#...
sizer_8 = wx.BoxSizer(wx.VERTICAL)
#...
sizer_4.Add(sizer_5, 1, wx.EXPAND, 0)
self.panel_4.SetAutoLayout
(True)
self.panel_4.SetSizer(sizer_8)
sizer_8.Fit(self.panel_4)
sizer_8.SetSizeHints(self.panel_4)
sizer_8.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW)
sizer_8.Add(self.toolbar
, 0, wxGROW)