def __init__(self, parent, dirname, filename): self.dirname = dirname self.filename = filename wx.Dialog.__init__(self, parent=parent, title="Compare plots", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX) self.graph = PanelGraphCompare(self) self.buttonPlot1 = wx.Button(self, wx.ID_ANY, 'Load plot #1') self.buttonPlot2 = wx.Button(self, wx.ID_ANY, 'Load plot #2') self.Bind(wx.EVT_BUTTON, self.on_load_plot, self.buttonPlot1) self.Bind(wx.EVT_BUTTON, self.on_load_plot, self.buttonPlot2) self.textPlot1 = wx.StaticText(self, label="<None>") self.textPlot2 = wx.StaticText(self, label="<None>") buttonClose = wx.Button(self, wx.ID_CLOSE, 'Close') self.Bind(wx.EVT_BUTTON, self.on_close, buttonClose) grid = wx.GridBagSizer(5, 5) grid.AddGrowableCol(2, 0) grid.Add(self.buttonPlot1, pos=(0, 0), flag=wx.ALIGN_CENTRE) grid.Add(self.textPlot1, pos=(0, 1), span=(1, 2)) grid.Add(self.buttonPlot2, pos=(1, 0), flag=wx.ALIGN_CENTRE) grid.Add(self.textPlot2, pos=(1, 1), span=(1, 2)) grid.Add(buttonClose, pos=(2, 3), flag=wx.ALIGN_RIGHT) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.graph, 1, wx.EXPAND) sizer.Add(grid, 0, wx.EXPAND | wx.ALL, border=5) self.SetSizerAndFit(sizer) close_modeless()
def close(self): close_modeless()
def on_close(self, _event): close_modeless() self.EndModal(wx.ID_CLOSE)