python - Attaching plt.plot() on a panel created with wx.Panel -
i using wxpython , matplotlib create splitter window supports commands on 1 window , plots data on other. how plt.plot() attach plot on plotting window?
i popup window when run plt.plot() , not accept parent window argument. need use plt.plot() instead of backend modules such wxagg because has zoom , save file features , code looks simpler.
so "attach" mean doing similar following:
self.figure = figure(figsize = (5,7), dpi = `100) self.ax = self.figure.add_subplot(111) t = arange(0.0,3.0,0.01) s = sin(2*pi*t) self.ax.plot(t,s) self.canvas = figurecanvas(panel2,-1,self.figure) sizer = wx.boxsizer(wx.vertical) sizer.add(self.canvas,1,wx.all | wx.align_center | wx.expand) panel2.setsizer(sizer) panel2.fit() self.canvas.draw()
where when create figurecanvas instance can specify (panel2,...) in arguments, indicating want reside within panel. not worried making specific example work in general possible specify panel want pyplot.plot()? have used variables , class definitions pretty in every example given.
Comments
Post a Comment