From: Jan R. G. <jr...@gm...> - 2005-03-29 16:54:27
|
could anyone show me how to incorporate this example on my GUI? what i want to do is to implement this in a wxPanel that is part of my wxFrame, but i am getting errors that says wxPanel instance has no attribute GetToolBar... how am i going to get around with this??? actually, i am doing this because i'm making a graph based on some data stored on a list. what i am thinking is to just replace t,s,and c part of this example with my group of list : def plot_data(self): # Use ths line if using a toolbar a = self.fig.add_subplot(111) # Or this one if there is no toolbar #a = Subplot(self.fig, 111) t = numpy.arange(0.0,3.0,0.01) s = numpy.sin(2*numpy.pi*t) c = numpy.cos(2*numpy.pi*t) a.plot(t,s) a.plot(t,c) self.toolbar.update() please, i need help asap... |
From: Jan R. G. <jr...@gm...> - 2005-03-29 18:11:24
|
any help will be very much appreciated... or could you suggest a better implementation of this graphing part On Tue, 29 Mar 2005 08:54:06 -0800, Jan Rienyer Gadil <jr...@gm...> wrote: > could anyone show me how to incorporate this example on my GUI? > > what i want to do is to implement this in a wxPanel that is part of my > wxFrame, but i am getting errors that says wxPanel instance has no > attribute GetToolBar... > > how am i going to get around with this??? > > actually, i am doing this because i'm making a graph based on some > data stored on a list. what i am thinking is to just replace t,s,and c > part of this example with my group of list : > > def plot_data(self): > # Use ths line if using a toolbar > a = self.fig.add_subplot(111) > > # Or this one if there is no toolbar > #a = Subplot(self.fig, 111) > > t = numpy.arange(0.0,3.0,0.01) > s = numpy.sin(2*numpy.pi*t) > c = numpy.cos(2*numpy.pi*t) > a.plot(t,s) > a.plot(t,c) > self.toolbar.update() > > please, i need help asap... > |
From: Jan R. G. <jr...@gm...> - 2005-03-29 22:18:40
|
please, help me on this! On Tue, 29 Mar 2005 10:11:20 -0800, Jan Rienyer Gadil <jr...@gm...> wrote: > any help will be very much appreciated... > or could you suggest a better implementation of this graphing part > > > On Tue, 29 Mar 2005 08:54:06 -0800, Jan Rienyer Gadil <jr...@gm...> wrote: > > could anyone show me how to incorporate this example on my GUI? > > > > what i want to do is to implement this in a wxPanel that is part of my > > wxFrame, but i am getting errors that says wxPanel instance has no > > attribute GetToolBar... > > > > how am i going to get around with this??? > > > > actually, i am doing this because i'm making a graph based on some > > data stored on a list. what i am thinking is to just replace t,s,and c > > part of this example with my group of list : > > > > def plot_data(self): > > # Use ths line if using a toolbar > > a = self.fig.add_subplot(111) > > > > # Or this one if there is no toolbar > > #a = Subplot(self.fig, 111) > > > > t = numpy.arange(0.0,3.0,0.01) > > s = numpy.sin(2*numpy.pi*t) > > c = numpy.cos(2*numpy.pi*t) > > a.plot(t,s) > > a.plot(t,c) > > self.toolbar.update() > > > > please, i need help asap... > > > |
From: Matt N. <new...@ca...> - 2005-03-30 20:41:35
|
Jan, On many lists, asking 'please help me' three times in under twelve hours is liable to get you no help at all, and quite possibly prevent people from helping you in the future. > could anyone show me how to incorporate this example on my GUI? > > what i want to do is to implement this in a wxPanel that is > part of my wxFrame, but i am getting errors that says wxPanel > instance has no attribute GetToolBar... The embedding_in_wx*.py examples didn't help?? The code you posted doesn't have a wxPanel or a wxFrame, so it's difficult to say what the problem might be or what you actually want to do. In general, you can put a FigureCanvasXXX on a wxPanel or wxFrame. A simple example putting a figure on a wxPanel is below. Hope that helps, --Matt import wx from matplotlib.numerix import arange, sin, pi from matplotlib.figure import Figure from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg class PlotPanel(wx.Panel): def __init__(self,parent=None): wx.Panel.__init__(self,parent,-1) self.fig = Figure((5,4), 75) self.canvas = FigureCanvasWxAgg(self,-1,self.fig) self.axes = self.fig.add_axes([0.12,0.12,0.76,0.76]) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.canvas,1, wx.LEFT|wx.TOP) self.SetSizer(sizer) ; self.Fit() def plot(self,x,y): self.axes.cla() self.axes.plot(x,y) class PlotFrame(wx.Frame): def __init__(self,parent=None): wx.Frame.__init__(self,parent,-1,'Frame') self.plotpanel = PlotPanel(self) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(wx.StaticText(self, -1 , ' WX Matplotlib example ') ,0, wx.LEFT|wx.TOP) sizer.Add(self.plotpanel,1, wx.LEFT|wx.TOP) self.SetSizer(sizer) ; self.Fit() def plot(self,x,y): self.plotpanel.plot(x,y) if __name__ == '__main__': app = wx.PySimpleApp() frame = PlotFrame() x = arange(0,10.0,0.025) y = sin(x*pi/2) frame.plot(x,y) frame.Show() app.MainLoop() |