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()