示例#1
0
class NotebookFrame(wx.Notebook):
    """
    The notebook frame.
    """
    def __init__(self, parent, id=wx.ID_ANY, style=wx.BK_DEFAULT):
        wx.Notebook.__init__(self, parent, id=id, style=style)

        self.modelpanel = ModelPanel(self)
        self.plotpanel = PlotPanel(self)

        self.AddPage(self.modelpanel, "Data files")
        self.AddPage(self.plotpanel, "Plot")
        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.onPageChanging)
        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onPageChanging)

    def onPageChanging(self, event):
        new = event.GetSelection()
        if new == 1:
            self.plotpanel.update_model()
            self.plotpanel.SendSizeEvent()
        else:
            self.modelpanel.SendSizeEvent()

        # Necessary to actually cause page change
        event.Skip()
示例#2
0
    def __init__(self, parent, id=wx.ID_ANY, style=wx.BK_DEFAULT):
        wx.Notebook.__init__(self, parent, id=id, style=style)

        self.modelpanel = ModelPanel(self)
        self.plotpanel = PlotPanel(self)

        self.AddPage(self.modelpanel, "Data files")
        self.AddPage(self.plotpanel, "Plot")
        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.onPageChanging)
        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onPageChanging)
示例#3
0
class PlotFrame(BaseFrame):
    """
    MatPlotlib 2D plot as a wx.Frame, using PlotPanel
    """
    def __init__(self, parent=None, size=(700,450), exit_callback=None, **kwds):
        self.exit_callback = exit_callback
        self.title  = '2D Plot Frame'
        self.panel = PlotPanel(self, parent)
        BaseFrame.__init__(self,parent=parent, panel=self.panel, size=size)
        self.BuildFrame(size=size, **kwds)
        
    def plot(self,x,y,**kw):
        """plot after clearing current plot """        
        self.panel.plot(x,y,**kw)
        
    def oplot(self,x,y,**kw):
        """generic plotting method, overplotting any existing plot """
        self.panel.oplot(x,y,**kw)

    def update_line(self,t,x,y,**kw):
        """overwrite data for trace t """
        self.panel.update_line(t,x,y,**kw)
示例#4
0
 def __init__(self, parent=None, size=(700,450), exit_callback=None, **kwds):
     self.exit_callback = exit_callback
     self.title  = '2D Plot Frame'
     self.panel = PlotPanel(self, parent)
     BaseFrame.__init__(self,parent=parent, panel=self.panel, size=size)
     self.BuildFrame(size=size, **kwds)