def __init__(self, parent=None, _larch=None, **kws): wx.Frame.__init__(self, parent, -1, size=XASVIEW_SIZE, style=FRAMESTYLE) self.last_array_sel = {} self.paths2read = [] title = "Larch XAS GUI: XAS Visualization and Analysis" self.larch_buffer = parent if not isinstance(parent, LarchFrame): self.larch_buffer = LarchFrame(_larch=_larch, is_standalone=False) self.larch_buffer.Show() self.larch_buffer.Raise() self.larch = self.larch_buffer.larchshell self.larch.symtable._sys.xas_viewer = Group() self.controller = XASController(wxparent=self, _larch=self.larch) self.current_filename = None self.subframes = {} self.plotframe = None self.SetTitle(title) self.SetSize(XASVIEW_SIZE) self.SetFont(Font(FONTSIZE)) self.larch_buffer.Hide() self.createMainPanel() self.createMenus() self.statusbar = self.CreateStatusBar(2, style=wx.STB_DEFAULT_STYLE) self.statusbar.SetStatusWidths([-3, -1]) statusbar_fields = [" ", "initializing...."] for i in range(len(statusbar_fields)): self.statusbar.SetStatusText(statusbar_fields[i], i)
def createMainPanel(self): display0 = wx.Display(0) client_area = display0.ClientArea xmin, ymin, xmax, ymax = client_area xpos = int((xmax-xmin)*0.02) + xmin ypos = int((ymax-ymin)*0.04) + ymin self.SetPosition((xpos, ypos)) splitter = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE) splitter.SetMinimumPaneSize(250) leftpanel = wx.Panel(splitter) ltop = wx.Panel(leftpanel) def Btn(msg, x, act): b = Button(ltop, msg, size=(x, 30), action=act) b.SetFont(Font(FONTSIZE)) return b sel_none = Btn('Select None', 120, self.onSelNone) sel_all = Btn('Select All', 120, self.onSelAll) self.controller.filelist = FileCheckList(leftpanel, # main=self, select_action=self.ShowFile, remove_action=self.RemoveFile) tsizer = wx.BoxSizer(wx.HORIZONTAL) tsizer.Add(sel_all, 1, LCEN|wx.GROW, 1) tsizer.Add(sel_none, 1, LCEN|wx.GROW, 1) pack(ltop, tsizer) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(ltop, 0, LCEN|wx.GROW, 1) sizer.Add(self.controller.filelist, 1, LCEN|wx.GROW|wx.ALL, 1) pack(leftpanel, sizer) # right hand side panel = wx.Panel(splitter) sizer = wx.BoxSizer(wx.VERTICAL) self.title = SimpleText(panel, 'initializing...', size=(300, -1)) self.title.SetFont(Font(FONTSIZE+2)) ir = 0 sizer.Add(self.title, 0, LCEN|wx.GROW|wx.ALL, 1) self.nb = flatnotebook(panel, NB_PANELS, panelkws=dict(controller=self.controller), on_change=self.onNBChanged) sizer.Add(self.nb, 1, LCEN|wx.EXPAND, 2) pack(panel, sizer) splitter.SplitVertically(leftpanel, panel, 1) wx.CallAfter(self.init_larch)
def show_report(self, fitresult, evt=None): shown = False try: self.report_frame.Raise() shown = True except: del self.report_frame if not shown: self.report_frame = ReportFrame(self.wxparent) model_repr = fitresult.model._reprstring(long=True) report = fit_report(fitresult, show_correl=True, min_correl=0.25, sort_pars=True) self.report_frame.SetFont(Font(FONTSIZE - 1)) self.report_frame.set_text(report) self.report_frame.SetFont(Font(FONTSIZE - 1)) self.report_frame.Raise()
def build_display(self): """build display""" titleopts = dict(font=Font(11), colour='#AA0000') self.panel.Add(SimpleText(self.panel, self.title, **titleopts), dcol=7) self.panel.Add(SimpleText(self.panel, ' coming soon....'), dcol=7, newrow=True) self.panel.pack() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.panel, 1, wx.LEFT | wx.CENTER, 3) pack(self, sizer)
def __init__(self, parent, controller, title='Generic Panel', configname='task_config', config=None, **kws): wx.Panel.__init__(self, parent, -1, size=(550, 625), **kws) self.parent = parent self.controller = controller self.larch = controller.larch self.title = title self.configname = configname if config is not None: self.set_defaultconfig(config) self.wids = {} self.subframes = {} self.SetFont(Font(FONTSIZE)) self.titleopts = dict(font=Font(FONTSIZE+2), colour='#AA0000') self.panel = GridPanel(self, ncols=7, nrows=10, pad=2, itemstyle=LCEN) self.panel.sizer.SetVGap(5) self.panel.sizer.SetHGap(5) self.skip_process = True self.skip_plotting = False self.build_display() self.skip_process = False
def Btn(msg, x, act): b = Button(ltop, msg, size=(x, 30), action=act) b.SetFont(Font(FONTSIZE)) return b
def createMainPanel(self): display0 = wx.Display(0) client_area = display0.ClientArea xmin, ymin, xmax, ymax = client_area xpos = int((xmax - xmin) * 0.02) + xmin ypos = int((ymax - ymin) * 0.04) + ymin self.SetPosition((xpos, ypos)) splitter = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE) splitter.SetMinimumPaneSize(250) leftpanel = wx.Panel(splitter) ltop = wx.Panel(leftpanel) def Btn(msg, x, act): b = Button(ltop, msg, size=(x, 30), action=act) b.SetFont(Font(FONTSIZE)) return b sel_none = Btn('Select None', 120, self.onSelNone) sel_all = Btn('Select All', 120, self.onSelAll) self.controller.filelist = FileCheckList( leftpanel, # main=self, select_action=self.ShowFile, remove_action=self.RemoveFile) tsizer = wx.BoxSizer(wx.HORIZONTAL) tsizer.Add(sel_all, 1, LCEN | wx.GROW, 1) tsizer.Add(sel_none, 1, LCEN | wx.GROW, 1) pack(ltop, tsizer) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(ltop, 0, LCEN | wx.GROW, 1) sizer.Add(self.controller.filelist, 1, LCEN | wx.GROW | wx.ALL, 1) pack(leftpanel, sizer) # right hand side panel = wx.Panel(splitter) sizer = wx.BoxSizer(wx.VERTICAL) self.title = SimpleText(panel, 'initializing...', size=(300, -1)) self.title.SetFont(Font(FONTSIZE + 1)) ir = 0 sizer.Add(self.title, 0, LCEN | wx.GROW | wx.ALL, 1) self.nb = flat_nb.FlatNotebook(panel, -1, agwStyle=FNB_STYLE) self.nb.SetTabAreaColour(wx.Colour(250, 250, 250)) self.nb.SetActiveTabColour(wx.Colour(254, 254, 195)) self.nb.SetNonActiveTabTextColour(wx.Colour(10, 10, 128)) self.nb.SetActiveTabTextColour(wx.Colour(128, 0, 0)) self.nb_panels = [] for name, creator in NB_PANELS: _panel = creator(parent=self, controller=self.controller) self.nb.AddPage(_panel, " %s " % name, True) self.nb_panels.append(_panel) sizer.Add(self.nb, 1, LCEN | wx.EXPAND, 2) self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onNBChanged) self.nb.SetSelection(0) pack(panel, sizer) splitter.SplitVertically(leftpanel, panel, 1) wx.CallAfter(self.init_larch)
def build_display(self): self.mod_nb = flat_nb.FlatNotebook(self, -1, agwStyle=FNB_STYLE) self.mod_nb.SetTabAreaColour(wx.Colour(250,250,250)) self.mod_nb.SetActiveTabColour(wx.Colour(254,254,195)) self.mod_nb.SetNonActiveTabTextColour(wx.Colour(10,10,128)) self.mod_nb.SetActiveTabTextColour(wx.Colour(128,0,0)) self.mod_nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onNBChanged) pan = self.panel = GridPanel(self, ncols=4, nrows=4, pad=2, itemstyle=LCEN) self.wids = {} def FloatSpinWithPin(name, value, **kws): s = wx.BoxSizer(wx.HORIZONTAL) self.wids[name] = FloatSpin(pan, value=value, **kws) bb = BitmapButton(pan, get_icon('pin'), size=(25, 25), action=partial(self.onSelPoint, opt=name), tooltip='use last point selected from plot') s.Add(self.wids[name]) s.Add(bb) return s opts = dict(digits=2, increment=0.1) ppeak_e0 = FloatSpinWithPin('ppeak_e0', value=0, **opts) ppeak_elo = FloatSpinWithPin('ppeak_elo', value=-15, **opts) ppeak_ehi = FloatSpinWithPin('ppeak_ehi', value=-5, **opts) ppeak_emin = FloatSpinWithPin('ppeak_emin', value=-30, **opts) ppeak_emax = FloatSpinWithPin('ppeak_emax', value=0, **opts) self.fitbline_btn = Button(pan,'Fit Baseline', action=self.onFitBaseline, size=(150, 25)) self.fitmodel_btn = Button(pan, 'Fit Model', action=self.onFitModel, size=(150, 25)) self.fitsel_btn = Button(pan, 'Fit Selected Groups', action=self.onFitSelected, size=(150, 25)) self.fitmodel_btn.Disable() self.fitsel_btn.Disable() self.array_choice = Choice(pan, size=(150, -1), choices=list(Array_Choices.keys())) self.array_choice.SetSelection(1) models_peaks = Choice(pan, size=(150, -1), choices=ModelChoices['peaks'], action=self.addModel) models_other = Choice(pan, size=(150, -1), choices=ModelChoices['other'], action=self.addModel) self.plot_choice = Choice(pan, size=(150, -1), choices=PlotChoices, action=self.onPlot) self.message = SimpleText(pan, 'first fit baseline, then add peaks to fit model.') self.msg_centroid = SimpleText(pan, '----') opts = dict(default=True, size=(75, -1), action=self.onPlot) self.show_centroid = Check(pan, label='show?', **opts) self.show_peakrange = Check(pan, label='show?', **opts) self.show_fitrange = Check(pan, label='show?', **opts) self.show_e0 = Check(pan, label='show?', **opts) opts = dict(default=False, size=(200, -1), action=self.onPlot) self.plot_sub_bline = Check(pan, label='Subtract Baseline?', **opts) def add_text(text, dcol=1, newrow=True): pan.Add(SimpleText(pan, text), dcol=dcol, newrow=newrow) titleopts = dict(font=Font(12), colour='#AA0000') pan.Add(SimpleText(pan, ' Pre-edge Peak Fitting', **titleopts), dcol=5) add_text(' Run Fit:', newrow=False) add_text('Array to fit: ') pan.Add(self.array_choice, dcol=3) pan.Add((10, 10)) pan.Add(self.fitbline_btn) add_text('E0: ') pan.Add(ppeak_e0) pan.Add((10, 10), dcol=2) pan.Add(self.show_e0) pan.Add(self.fitmodel_btn) add_text('Fit Energy Range: ') pan.Add(ppeak_emin) add_text(' : ', newrow=False) pan.Add(ppeak_emax) pan.Add(self.show_fitrange) pan.Add(self.fitsel_btn) t = SimpleText(pan, 'Pre-edge Peak Range: ') t.SetToolTip('Range used as mask for background') pan.Add(t, newrow=True) pan.Add(ppeak_elo) add_text(' : ', newrow=False) pan.Add(ppeak_ehi) pan.Add(self.show_peakrange) add_text( 'Peak Centroid: ') pan.Add(self.msg_centroid, dcol=3) pan.Add(self.show_centroid, dcol=1) # plot buttons ts = wx.BoxSizer(wx.HORIZONTAL) ts.Add(self.plot_choice) ts.Add(self.plot_sub_bline) pan.Add(SimpleText(pan, 'Plot: '), newrow=True) pan.Add(ts, dcol=7) # add model ts = wx.BoxSizer(wx.HORIZONTAL) ts.Add(models_peaks) ts.Add(models_other) pan.Add(SimpleText(pan, 'Add Component: '), newrow=True) pan.Add(ts, dcol=7) pan.Add(SimpleText(pan, 'Messages: '), newrow=True) pan.Add(self.message, dcol=7) pan.pack() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add((5,5), 0, LCEN, 3) sizer.Add(HLine(self, size=(550, 2)), 0, LCEN, 3) sizer.Add(pan, 0, LCEN, 3) sizer.Add((5,5), 0, LCEN, 3) sizer.Add(HLine(self, size=(550, 2)), 0, LCEN, 3) sizer.Add((5,5), 0, LCEN, 3) sizer.Add(self.mod_nb, 1, LCEN|wx.GROW, 10) pack(self, sizer)
def build(self): sizer = wx.GridBagSizer(10, 5) sizer.SetVGap(5) sizer.SetHGap(5) panel = scrolled.ScrolledPanel(self) self.SetMinSize((600, 450)) self.colors = GUIColors() # title row self.wids = wids = {} title = SimpleText(panel, 'Fit Results', font=Font(12), colour=self.colors.title, style=LCEN) wids['data_title'] = SimpleText(panel, '< > ', font=Font(12), colour=self.colors.title, style=LCEN) wids['hist_info'] = SimpleText(panel, ' ___ ', font=Font(12), colour=self.colors.title, style=LCEN) sizer.Add(title, (0, 0), (1, 2), LCEN) sizer.Add(wids['data_title'], (0, 2), (1, 2), LCEN) sizer.Add(wids['hist_info'], (0, 4), (1, 2), LCEN) irow = 1 wids['model_desc'] = SimpleText(panel, '<Model>', font=Font(12), size=(550, 75), style=LCEN) sizer.Add(wids['model_desc'], (irow, 0), (1, 6), LCEN) irow += 1 sizer.Add(HLine(panel, size=(400, 3)), (irow, 0), (1, 5), LCEN) irow += 1 title = SimpleText(panel, '[[Fit Statistics]]', font=Font(12), colour=self.colors.title, style=LCEN) sizer.Add(title, (irow, 0), (1, 4), LCEN) for label, attr in (('Fit method', 'method'), ('# Fit Evaluations', 'nfev'), ('# Data Points', 'ndata'), ('# Fit Variables', 'nvarys'), ('# Free Points', 'nfree'), ('Chi-square', 'chisqr'), ('Reduced Chi-square', 'redchi'), ('Akaike Info Criteria', 'aic'), ('Bayesian Info Criteria', 'bic')): irow += 1 wids[attr] = SimpleText(panel, '?') sizer.Add(SimpleText(panel, " %s = " % label), (irow, 0), (1, 1), LCEN) sizer.Add(wids[attr], (irow, 1), (1, 1), LCEN) irow += 1 sizer.Add(HLine(panel, size=(400, 3)), (irow, 0), (1, 5), LCEN) irow += 1 title = SimpleText(panel, '[[Variables]]', font=Font(12), colour=self.colors.title, style=LCEN) sizer.Add(title, (irow, 0), (1, 1), LCEN) self.wids['copy_params'] = Button(panel, 'Update Model with Best Fit Values', size=(250, -1), action=self.onCopyParams) sizer.Add(self.wids['copy_params'], (irow, 1), (1, 3), LCEN) dvstyle = dv.DV_SINGLE|dv.DV_VERT_RULES|dv.DV_ROW_LINES pview = self.wids['params'] = dv.DataViewListCtrl(panel, style=dvstyle) self.wids['paramsdata'] = [] pview.AppendTextColumn('Parameter', width=150) pview.AppendTextColumn('Best-Fit Value', width=100) pview.AppendTextColumn('Standard Error', width=100) pview.AppendTextColumn('Info ', width=275) for col in (0, 1, 2, 3): this = pview.Columns[col] isort, align = True, wx.ALIGN_LEFT if col in (1, 2): isort, align = False, wx.ALIGN_RIGHT this.Sortable = isort this.Alignment = this.Renderer.Alignment = align pview.SetMinSize((650, 200)) pview.Bind(dv.EVT_DATAVIEW_SELECTION_CHANGED, self.onSelectParameter) irow += 1 sizer.Add(pview, (irow, 0), (1, 5), LCEN) irow += 1 sizer.Add(HLine(panel, size=(400, 3)), (irow, 0), (1, 5), LCEN) irow += 1 title = SimpleText(panel, '[[Correlations]]', font=Font(12), colour=self.colors.title, style=LCEN) self.wids['all_correl'] = Button(panel, 'Show All', size=(100, -1), action=self.onAllCorrel) self.wids['min_correl'] = FloatSpin(panel, value=MIN_CORREL, min_val=0, size=(60, -1), digits=3, increment=0.1) ctitle = SimpleText(panel, 'minimum correlation: ') sizer.Add(title, (irow, 0), (1, 1), LCEN) sizer.Add(ctitle, (irow, 1), (1, 1), LCEN) sizer.Add(self.wids['min_correl'], (irow, 2), (1, 1), LCEN) sizer.Add(self.wids['all_correl'], (irow, 3), (1, 1), LCEN) irow += 1 cview = self.wids['correl'] = dv.DataViewListCtrl(panel, style=dvstyle) cview.AppendTextColumn('Parameter 1', width=150) cview.AppendTextColumn('Parameter 2', width=150) cview.AppendTextColumn('Correlation', width=100) for col in (0, 1, 2): this = cview.Columns[col] isort, align = True, wx.ALIGN_LEFT if col == 1: isort = False if col == 2: align = wx.ALIGN_RIGHT this.Sortable = isort this.Alignment = this.Renderer.Alignment = align cview.SetMinSize((450, 200)) irow += 1 sizer.Add(cview, (irow, 0), (1, 5), LCEN) irow += 1 sizer.Add(HLine(panel, size=(400, 3)), (irow, 0), (1, 5), LCEN) pack(panel, sizer) panel.SetupScrolling() mainsizer = wx.BoxSizer(wx.VERTICAL) mainsizer.Add(panel, 1, wx.GROW|wx.ALL, 1) pack(self, mainsizer) self.Show() self.Raise()
def build_display(self): titleopts = dict(font=Font(12), colour='#AA0000') panel = self.panel wids = self.wids self.skip_process = True wids['plotone_op'] = Choice(panel, choices=PlotOne_Choices, action=self.onPlotOne, size=(175, -1)) wids['plotalt_op'] = Choice(panel, choices=PlotAlt_Choices, action=self.onPlotOne, size=(175, -1)) wids['plotsel_op'] = Choice(panel, choices=PlotSel_Choices, action=self.onPlotSel, size=(175, -1)) wids['plotone_op'].SetStringSelection(chik) wids['plotsel_op'].SetStringSelection(chik) wids['plotalt_op'].SetStringSelection(noplot) plot_one = Button(panel, 'Plot This Group', size=(150, -1), action=self.onPlotOne) plot_sel = Button(panel, 'Plot Selected Groups', size=(150, -1), action=self.onPlotSel) saveconf = Button(panel, 'Save as Default Settings', size=(200, -1), action=self.onSaveConfigBtn) def FloatSpinWithPin(name, value, **kws): s = wx.BoxSizer(wx.HORIZONTAL) self.wids[name] = FloatSpin(panel, value=value, **kws) bb = BitmapButton(panel, get_icon('pin'), size=(25, 25), action=partial(self.onSelPoint, opt=name), tooltip='use last point selected from plot') s.Add(wids[name]) s.Add(bb) return s wids['plot_voffset'] = FloatSpin(panel, value=0, digits=2, increment=0.25, action=self.onProcess) wids['plot_kweight'] = FloatSpin(panel, value=2, digits=1, increment=1, action=self.onProcess, min_val=0, max_val=5) wids['plot_kweight_alt'] = FloatSpin(panel, value=2, digits=1, increment=1, action=self.onProcess, min_val=0, max_val=5) opts = dict(digits=2, increment=0.1, min_val=0, action=self.onProcess) wids['e0'] = FloatSpin(panel, **opts) opts['max_val'] = 5 wids['rbkg'] = FloatSpin(panel, value=1.0, **opts) opts['max_val'] = 125 bkg_kmin = FloatSpinWithPin('bkg_kmin', value=0, **opts) bkg_kmax = FloatSpinWithPin('bkg_kmax', value=20, **opts) fft_kmin = FloatSpinWithPin('fft_kmin', value=0, **opts) fft_kmax = FloatSpinWithPin('fft_kmax', value=20, **opts) wids['fft_dk'] = FloatSpin(panel, value=3, **opts) opts.update({'increment': 1, 'digits': 1, 'max_val': 5}) wids['bkg_kweight'] = FloatSpin(panel, value=1, **opts) wids['fft_kweight'] = FloatSpin(panel, value=1, **opts) opts = dict(choices=CLAMPLIST, size=(80, -1), action=self.onProcess) wids['bkg_clamplo'] = Choice(panel, **opts) wids['bkg_clamphi'] = Choice(panel, **opts) wids['fft_kwindow'] = Choice(panel, choices=list(FTWINDOWS), action=self.onProcess, size=(125, -1)) def add_text(text, dcol=1, newrow=True): panel.Add(SimpleText(panel, text), dcol=dcol, newrow=newrow) panel.Add(SimpleText(panel, ' EXAFS Processing', **titleopts), dcol=5) panel.Add(plot_sel, newrow=True) panel.Add(self.wids['plotsel_op'], dcol=2) add_text('Vertical offset: ', newrow=False) panel.Add(wids['plot_voffset'], dcol=2) panel.Add(plot_one, newrow=True) panel.Add(self.wids['plotone_op'], dcol=2) add_text('Plot k weight: ', newrow=False) panel.Add(wids['plot_kweight']) add_text('Add Second Plot: ', newrow=True) panel.Add(self.wids['plotalt_op'], dcol=2) add_text('Plot2 k weight: ', newrow=False) panel.Add(wids['plot_kweight_alt']) panel.Add(HLine(panel, size=(500, 3)), dcol=6, newrow=True) panel.Add(SimpleText(panel, ' Background subtraction', **titleopts), dcol=2, newrow=True) panel.Add(Button(panel, 'Copy To Selected Groups', size=(175, -1), action=partial(self.onCopyParam, 'bkg')), dcol=2) add_text('R bkg: ') panel.Add(wids['rbkg']) add_text('E0: ', newrow=False) panel.Add(wids['e0']) add_text('k min: ') panel.Add(bkg_kmin) add_text('k max:', newrow=False) panel.Add(bkg_kmax) add_text('kweight: ', newrow=True) panel.Add(wids['bkg_kweight'], dcol=1) add_text('Clamps Low E: ', newrow=True) panel.Add(wids['bkg_clamplo']) add_text('high E: ', newrow=False) panel.Add(wids['bkg_clamphi']) panel.Add(HLine(panel, size=(500, 3)), dcol=6, newrow=True) panel.Add(SimpleText(panel, ' Fourier transform', **titleopts), dcol=2, newrow=True) panel.Add(Button(panel, 'Copy to Selected Groups', size=(175, -1), action=partial(self.onCopyParam, 'fft')), dcol=2) panel.Add(SimpleText(panel, 'k min: '), newrow=True) panel.Add(fft_kmin) panel.Add(SimpleText(panel, 'k max:')) panel.Add(fft_kmax) panel.Add(SimpleText(panel, 'k weight : '), newrow=True) panel.Add(wids['fft_kweight']) panel.Add(SimpleText(panel, 'K window : '), newrow=True) panel.Add(wids['fft_kwindow']) panel.Add(SimpleText(panel, ' dk : ')) panel.Add(wids['fft_dk']) panel.Add(HLine(panel, size=(500, 3)), dcol=6, newrow=True) panel.Add(saveconf, dcol=4, newrow=True) panel.pack() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(panel, 1, LCEN, 3) pack(self, sizer) self.skip_process = False
def build_display(self): titleopts = dict(font=Font(12), colour='#AA0000') xas = self.panel self.wids = {} self.plotone_op = Choice(xas, choices=list(PlotOne_Choices.keys()), action=self.onPlotOne, size=(175, -1)) self.plotsel_op = Choice(xas, choices=list(PlotSel_Choices.keys()), action=self.onPlotSel, size=(175, -1)) self.plotone_op.SetSelection(1) self.plotsel_op.SetSelection(1) plot_one = Button(xas, 'Plot This Group', size=(150, -1), action=self.onPlotOne) plot_sel = Button(xas, 'Plot Selected Groups', size=(150, -1), action=self.onPlotSel) opts = dict(action=self.onReprocess) e0opts_panel = wx.Panel(xas) self.wids['autoe0'] = Check(e0opts_panel, default=True, label='auto?', **opts) self.wids['showe0'] = Check(e0opts_panel, default=True, label='show?', **opts) sx = wx.BoxSizer(wx.HORIZONTAL) sx.Add(self.wids['autoe0'], 0, LCEN, 4) sx.Add(self.wids['showe0'], 0, LCEN, 4) pack(e0opts_panel, sx) self.wids['autostep'] = Check(xas, default=True, label='auto?', **opts) opts['size'] = (50, -1) self.wids['vict'] = Choice(xas, choices=('0', '1', '2', '3'), **opts) self.wids['nnor'] = Choice(xas, choices=('0', '1', '2', '3'), **opts) self.wids['vict'].SetSelection(1) self.wids['nnor'].SetSelection(1) opts.update({'size': (100, -1), 'digits': 2, 'increment': 5.0}) xas_pre1 = self.add_floatspin('pre1', value=-1000, **opts) xas_pre2 = self.add_floatspin('pre2', value=-30, **opts) xas_nor1 = self.add_floatspin('nor1', value=50, **opts) xas_nor2 = self.add_floatspin('nor2', value=5000, **opts) opts = {'digits': 2, 'increment': 0.1, 'value': 0} xas_e0 = self.add_floatspin('e0', action=self.onSet_XASE0, **opts) xas_step = self.add_floatspin('step', action=self.onSet_XASStep, with_pin=False, **opts) saveconf = Button(xas, 'Save as Default Settings', size=(200, -1), action=self.onSaveConfigBtn) def CopyBtn(name): return Button(xas, 'Copy', size=(50, -1), action=partial(self.onCopyParam, name)) add_text = self.add_text xas.Add(SimpleText(xas, ' XAS Pre-edge subtraction and Normalization', **titleopts), dcol=4) xas.Add(SimpleText(xas, 'Copy to Selected Groups?'), style=RCEN, dcol=3) xas.Add(plot_sel, newrow=True) xas.Add(self.plotsel_op, dcol=6) xas.Add(plot_one, newrow=True) xas.Add(self.plotone_op, dcol=4) xas.Add((10, 10)) xas.Add(CopyBtn('plotone_op'), style=RCEN) add_text('E0 : ') xas.Add(xas_e0) xas.Add(e0opts_panel, dcol=3) xas.Add((10, 1)) xas.Add(CopyBtn('xas_e0'), style=RCEN) add_text('Edge Step: ') xas.Add(xas_step) xas.Add(self.wids['autostep'], dcol=3) xas.Add((10, 1)) xas.Add(CopyBtn('xas_step'), style=RCEN) add_text('Pre-edge range: ') xas.Add(xas_pre1) add_text(' : ', newrow=False) xas.Add(xas_pre2) xas.Add(SimpleText(xas, 'Victoreen:')) xas.Add(self.wids['vict']) xas.Add(CopyBtn('xas_pre'), style=RCEN) add_text('Normalization range: ') xas.Add(xas_nor1) add_text(' : ', newrow=False) xas.Add(xas_nor2) xas.Add(SimpleText(xas, 'Poly Order:')) xas.Add(self.wids['nnor']) xas.Add(CopyBtn('xas_norm'), style=RCEN) xas.Add(saveconf, dcol=6, newrow=True) xas.pack() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add((5, 5), 0, LCEN, 3) sizer.Add(HLine(self, size=(550, 2)), 0, LCEN, 3) sizer.Add(xas, 0, LCEN, 3) sizer.Add((5, 5), 0, LCEN, 3) sizer.Add(HLine(self, size=(550, 2)), 0, LCEN, 3) pack(self, sizer)
def build(self): sizer = wx.GridBagSizer(5, 5) sizer.SetVGap(5) sizer.SetHGap(5) splitter = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE) splitter.SetMinimumPaneSize(200) self.datalistbox = EditableListBox(splitter, self.ShowDataSet, size=(250, -1)) panel = scrolled.ScrolledPanel(splitter) self.SetMinSize((650, 600)) self.colors = GUIColors() # title row self.wids = wids = {} title = SimpleText(panel, 'Linear Combination Results', font=Font(FONTSIZE + 2), colour=self.colors.title, style=LEFT) wids['plot_one'] = Button(panel, 'Plot This Fit', size=(125, -1), action=self.onPlotOne) wids['plot_sel'] = Button(panel, 'Plot N Best Fits', size=(125, -1), action=self.onPlotSel) wids['plot_ntitle'] = SimpleText(panel, 'N fits to plot: ') wids['plot_nchoice'] = Choice(panel, size=(60, -1), choices=['%d' % i for i in range(1, 21)]) wids['plot_nchoice'].SetStringSelection('5') wids['data_title'] = SimpleText(panel, '<--> ', font=Font(FONTSIZE + 2), colour=self.colors.title, style=LEFT) wids['nfits_title'] = SimpleText(panel, 'showing 5 best fits') copts = dict(size=(125, 30), default=True, action=self.onPlotOne) # wids['show_e0'] = Check(panel, label='show E0?', **copts) wids['show_fitrange'] = Check(panel, label='show fit range?', **copts) irow = 0 sizer.Add(title, (irow, 0), (1, 1), LEFT) sizer.Add(wids['data_title'], (irow, 1), (1, 2), LEFT) irow += 1 sizer.Add(wids['nfits_title'], (irow, 0), (1, 1), LEFT) irow += 1 self.wids['paramstitle'] = SimpleText(panel, '[[Parameters]]', font=Font(FONTSIZE + 2), colour=self.colors.title, style=LEFT) sizer.Add(self.wids['paramstitle'], (irow, 0), (1, 1), LEFT) pview = self.wids['params'] = dv.DataViewListCtrl(panel, style=DVSTYLE) pview.SetMinSize((475, 200)) pview.AppendTextColumn(' Parameter ', width=230) pview.AppendTextColumn(' Best-Fit Value', width=120) pview.AppendTextColumn(' Standard Error ', width=120) for col in range(3): this = pview.Columns[col] isort, align = True, wx.ALIGN_RIGHT if col == 0: align = wx.ALIGN_LEFT this.Sortable = isort this.Alignment = this.Renderer.Alignment = align irow += 1 sizer.Add(self.wids['params'], (irow, 0), (4, 1), LEFT) sizer.Add(self.wids['plot_one'], (irow, 1), (1, 2), LEFT) sizer.Add(self.wids['plot_sel'], (irow + 1, 1), (1, 2), LEFT) sizer.Add(self.wids['plot_ntitle'], (irow + 2, 1), (1, 1), LEFT) sizer.Add(self.wids['plot_nchoice'], (irow + 2, 2), (1, 1), LEFT) # sizer.Add(self.wids['show_e0'], (irow+3, 1), (1, 2), LEFT) sizer.Add(self.wids['show_fitrange'], (irow + 3, 1), (1, 2), LEFT) irow += 4 sizer.Add(HLine(panel, size=(675, 3)), (irow, 0), (1, 4), LEFT) sview = self.wids['stats'] = dv.DataViewListCtrl(panel, style=DVSTYLE) sview.Bind(dv.EVT_DATAVIEW_SELECTION_CHANGED, self.onSelectFitStat) sview.AppendTextColumn(' Fit #', width=50) sview.AppendTextColumn(' N_vary', width=50) sview.AppendTextColumn(' N_eval', width=60) sview.AppendTextColumn(' \u03c7\u00B2', width=110) sview.AppendTextColumn(' \u03c7\u00B2_reduced', width=110) sview.AppendTextColumn(' Akaike Info', width=110) sview.AppendTextColumn(' Bayesian Info', width=110) for col in range(sview.ColumnCount): this = sview.Columns[col] isort, align = True, wx.ALIGN_RIGHT if col == 0: align = wx.ALIGN_CENTER this.Sortable = isort this.Alignment = this.Renderer.Alignment = align sview.SetMinSize((675, 175)) irow += 1 title = SimpleText(panel, '[[Fit Statistics]]', font=Font(FONTSIZE + 2), colour=self.colors.title, style=LEFT) sizer.Add(title, (irow, 0), (1, 4), LEFT) irow += 1 sizer.Add(sview, (irow, 0), (1, 4), LEFT) irow += 1 sizer.Add(HLine(panel, size=(675, 3)), (irow, 0), (1, 4), LEFT) irow += 1 title = SimpleText(panel, '[[Weights]]', font=Font(FONTSIZE + 2), colour=self.colors.title, style=LEFT) sizer.Add(title, (irow, 0), (1, 4), LEFT) self.wids['weightspanel'] = ppan = wx.Panel(panel) p1 = SimpleText(ppan, ' < Weights > ') os = wx.BoxSizer(wx.VERTICAL) os.Add(p1, 1, 3) pack(ppan, os) ppan.SetMinSize((675, 175)) irow += 1 sizer.Add(ppan, (irow, 0), (1, 4), LEFT) irow += 1 sizer.Add(HLine(panel, size=(675, 3)), (irow, 0), (1, 4), LEFT) pack(panel, sizer) panel.SetupScrolling() splitter.SplitVertically(self.datalistbox, panel, 1) mainsizer = wx.BoxSizer(wx.VERTICAL) mainsizer.Add(splitter, 1, wx.GROW | wx.ALL, 5) pack(self, mainsizer) # self.SetSize((725, 750)) self.Show() self.Raise()
def build_display(self): titleopts = dict(font=Font(12), colour='#AA0000') panel = self.panel wids = self.wids self.skip_process = True wids['fitspace'] = Choice(panel, choices=FitSpace_Choices, size=(175, -1)) wids['fitspace'].SetStringSelection(norm) wids['plotchoice'] = Choice(panel, choices=Plot_Choices, size=(175, -1), action=self.onPlot) wids['plotchoice'].SetSelection(1) add_text = self.add_text opts = dict(digits=2, increment=1.0, relative_e0=True) e0_wids = self.add_floatspin('e0', value=0, **opts) elo_wids = self.add_floatspin('elo', value=-20, **opts) ehi_wids = self.add_floatspin('ehi', value=30, **opts) wids['fit_group'] = Button(panel, 'Fit this Group', size=(150, -1), action=self.onFitOne) wids['fit_selected'] = Button(panel, 'Fit Selected Groups', size=(150, -1), action=self.onFitAll) wids['add_selected'] = Button(panel, 'Use Selected Groups as Components', size=(250, -1), action=self.onUseSelected) wids['saveconf'] = Button(panel, 'Save as Default Settings', size=(200, -1), action=self.onSaveConfigBtn) opts = dict(default=True, size=(75, -1), action=self.onPlotOne) wids['show_e0'] = Check(panel, label='show?', **opts) wids['show_fitrange'] = Check(panel, label='show?', **opts) wids['sum_to_one'] = Check(panel, label='Weights Must Sum to 1?', default=True) wids['all_combos'] = Check(panel, label='Fit All Combinations?', default=True) panel.Add(SimpleText(panel, ' Linear Combination Analysis', **titleopts), dcol=5) add_text('Run Fit', newrow=False) add_text('Array to Fit: ', newrow=True) panel.Add(wids['fitspace'], dcol=4) panel.Add(wids['fit_group']) add_text('Plot : ', newrow=True) panel.Add(wids['plotchoice'], dcol=4) panel.Add(wids['fit_selected']) add_text('E0: ') panel.Add(e0_wids, dcol=3) panel.Add(wids['show_e0']) add_text('Fit Energy Range: ') panel.Add(elo_wids) add_text(' : ', newrow=False) panel.Add(ehi_wids) panel.Add(wids['show_fitrange']) panel.Add(wids['sum_to_one'], dcol=2, newrow=True) panel.Add(wids['all_combos'], dcol=3) panel.Add(HLine(panel, size=(400, 2)), dcol=5, newrow=True) add_text('Components: ') panel.Add(wids['add_selected'], dcol=4) groupnames = [noname] + list(self.controller.file_groups.keys()) sgrid = GridPanel(panel, nrows=6) sgrid.Add(SimpleText(sgrid, "#")) sgrid.Add(SimpleText(sgrid, "Group")) sgrid.Add(SimpleText(sgrid, "Weight")) sgrid.Add(SimpleText(sgrid, "Min Weight")) sgrid.Add(SimpleText(sgrid, "Max Weight")) fopts = dict(minval=-10, maxval=20, precision=4, size=(60, -1)) for i in range(1, 1 + MAX_COMPONENTS): si = ("comp", "_%2.2d" % i) sgrid.Add(SimpleText(sgrid, "%2i" % i), newrow=True) wids['%schoice%s' % si] = Choice(sgrid, choices=groupnames, size=(200, -1), action=partial(self.onComponent, comp=i)) wids['%sval%s' % si] = FloatCtrl(sgrid, value=0, **fopts) wids['%smin%s' % si] = FloatCtrl(sgrid, value=0, **fopts) wids['%smax%s' % si] = FloatCtrl(sgrid, value=1, **fopts) for cname in ('choice', 'val', 'min', 'max'): sgrid.Add(wids[("%%s%s%%s" % cname) % si]) sgrid.pack() panel.Add(sgrid, dcol=5, newrow=True) panel.Add(HLine(panel, size=(400, 2)), dcol=5, newrow=True) panel.Add(wids['saveconf'], dcol=4, newrow=True) panel.pack() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(panel, 1, LCEN, 3) pack(self, sizer) self.skip_process = False
def build(self): sizer = wx.GridBagSizer(10, 5) sizer.SetVGap(5) sizer.SetHGap(5) panel = scrolled.ScrolledPanel(self) self.SetMinSize((675, 600)) self.colors = GUIColors() # title row self.wids = wids = {} title = SimpleText(panel, 'Linear Combination Results', font=Font(12), colour=self.colors.title, style=LCEN) wids['plot_one'] = Button(panel, 'Plot This Fit', size=(150, -1), action=self.onPlotOne) wids['plot_sel'] = Button(panel, 'Plot top N Fits', size=(150, -1), action=self.onPlotSel) wids['plot_ntitle'] = SimpleText(panel, 'N fits to plot: ') wids['plot_nchoice'] = Choice(panel, size=(100, -1), choices=['%d' % i for i in range(1, 21)]) wids['plot_nchoice'].SetStringSelection('5') wids['data_title'] = SimpleText(panel, '<--> ', font=Font(12), colour=self.colors.title, style=LCEN) wids['nfits_title'] = SimpleText(panel, 'showing top 5 fits') irow = 0 sizer.Add(title, (irow, 0), (1, 2), LCEN) sizer.Add(wids['data_title'], (irow, 2), (1, 2), LCEN) irow += 1 sizer.Add(wids['nfits_title'], (irow, 0), (1, 4), LCEN) irow += 1 sizer.Add(self.wids['plot_one'], (irow, 0), (1, 1), LCEN) sizer.Add(self.wids['plot_sel'], (irow, 1), (1, 1), LCEN) sizer.Add(self.wids['plot_ntitle'], (irow, 2), (1, 1), LCEN) sizer.Add(self.wids['plot_nchoice'], (irow, 3), (1, 1), LCEN) irow += 1 self.wids['paramstitle'] = SimpleText(panel, '[[Parameters]]', font=Font(12), colour=self.colors.title, style=LCEN) sizer.Add(self.wids['paramstitle'], (irow, 0), (1, 4), LCEN) pview = self.wids['params'] = dv.DataViewListCtrl(panel, style=DVSTYLE) pview.SetMinSize((675, 200)) pview.AppendTextColumn(' Parameter ', width=250) pview.AppendTextColumn(' Best-Fit Value', width=150) pview.AppendTextColumn(' Uncertainty ', width=150) for col in range(3): this = pview.Columns[col] isort, align = True, wx.ALIGN_RIGHT if col == 0: align = wx.ALIGN_LEFT this.Sortable = isort this.Alignment = this.Renderer.Alignment = align irow += 1 sizer.Add(self.wids['params'], (irow, 0), (1, 4), LCEN) irow += 1 sizer.Add(HLine(panel, size=(675, 3)), (irow, 0), (1, 4), LCEN) sview = self.wids['stats'] = dv.DataViewListCtrl(panel, style=DVSTYLE) sview.Bind(dv.EVT_DATAVIEW_SELECTION_CHANGED, self.onSelectFitStat) sview.AppendTextColumn(' Fit #', width=50) sview.AppendTextColumn(' N_Vary', width=60) sview.AppendTextColumn(' N_Data', width=60) sview.AppendTextColumn(' N_eval', width=60) sview.AppendTextColumn(u' \u03c7\u00B2', width=100) sview.AppendTextColumn(u' \u03c7\u00B2_reduced', width=100) sview.AppendTextColumn(' Akaike Info', width=100) sview.AppendTextColumn(' Bayesian Info', width=100) for col in range(8): this = sview.Columns[col] isort, align = True, wx.ALIGN_RIGHT if col == 0: align = wx.ALIGN_CENTER this.Sortable = isort this.Alignment = this.Renderer.Alignment = align sview.SetMinSize((675, 175)) irow += 1 title = SimpleText(panel, '[[Fit Statistics]]', font=Font(12), colour=self.colors.title, style=LCEN) sizer.Add(title, (irow, 0), (1, 4), LCEN) irow += 1 sizer.Add(sview, (irow, 0), (1, 4), LCEN) irow += 1 sizer.Add(HLine(panel, size=(675, 3)), (irow, 0), (1, 4), LCEN) irow += 1 title = SimpleText(panel, '[[Weights]]', font=Font(12), colour=self.colors.title, style=LCEN) sizer.Add(title, (irow, 0), (1, 4), LCEN) self.wids['weightspanel'] = ppan = wx.Panel(self) p1 = SimpleText(ppan, ' < Weights > ') os = wx.BoxSizer(wx.VERTICAL) os.Add(p1, 1, 3) pack(ppan, os) ppan.SetMinSize((675, 175)) irow += 1 sizer.Add(ppan, (irow, 0), (1, 4), LCEN) irow += 1 sizer.Add(HLine(panel, size=(675, 3)), (irow, 0), (1, 4), LCEN) pack(panel, sizer) panel.SetupScrolling() mainsizer = wx.BoxSizer(wx.VERTICAL) mainsizer.Add(panel, 1, wx.GROW | wx.ALL, 1) pack(self, mainsizer) self.Show() self.Raise()
def build(self): sizer = wx.GridBagSizer(10, 5) sizer.SetVGap(5) sizer.SetHGap(5) panel = scrolled.ScrolledPanel(self) self.SetMinSize((700, 450)) self.colors = GUIColors() # title row self.wids = wids = {} title = SimpleText(panel, 'Fit Results', font=Font(FONTSIZE+2), colour=self.colors.title, style=LEFT) wids['data_title'] = SimpleText(panel, '< > ', font=Font(FONTSIZE+2), colour=self.colors.title, style=LEFT) wids['hist_info'] = SimpleText(panel, ' ___ ', font=Font(FONTSIZE+2), colour=self.colors.title, style=LEFT) wids['hist_hint'] = SimpleText(panel, ' (Fit #01 is most recent)', font=Font(FONTSIZE+2), colour=self.colors.title, style=LEFT) opts = dict(default=False, size=(200, -1), action=self.onPlot) wids['plot_bline'] = Check(panel, label='Plot baseline-subtracted?', **opts) wids['plot_resid'] = Check(panel, label='Plot with residual?', **opts) self.plot_choice = Button(panel, 'Plot Selected Fit', size=(175, -1), action=self.onPlot) self.save_result = Button(panel, 'Save Selected Model', size=(175, -1), action=self.onSaveFitResult) SetTip(self.save_result, 'save model and result to be loaded later') self.export_fit = Button(panel, 'Export Fit', size=(175, -1), action=self.onExportFitResult) SetTip(self.export_fit, 'save arrays and results to text file') irow = 0 sizer.Add(title, (irow, 0), (1, 2), LEFT) sizer.Add(wids['data_title'], (irow, 2), (1, 2), LEFT) irow += 1 sizer.Add(wids['hist_info'], (irow, 0), (1, 2), LEFT) sizer.Add(wids['hist_hint'], (irow, 2), (1, 2), LEFT) irow += 1 wids['model_desc'] = SimpleText(panel, '<Model>', font=Font(FONTSIZE+1), size=(700, 50), style=LEFT) sizer.Add(wids['model_desc'], (irow, 0), (1, 6), LEFT) irow += 1 sizer.Add(self.save_result, (irow, 0), (1, 1), LEFT) sizer.Add(self.export_fit, (irow, 1), (1, 2), LEFT) irow += 1 # sizer.Add(SimpleText(panel, 'Plot: '), (irow, 0), (1, 1), LEFT) sizer.Add(self.plot_choice, (irow, 0), (1, 2), LEFT) sizer.Add(wids['plot_bline'], (irow, 2), (1, 1), LEFT) sizer.Add(wids['plot_resid'], (irow, 3), (1, 1), LEFT) irow += 1 sizer.Add(HLine(panel, size=(650, 3)), (irow, 0), (1, 5), LEFT) irow += 1 title = SimpleText(panel, '[[Fit Statistics]]', font=Font(FONTSIZE+2), colour=self.colors.title, style=LEFT) sizer.Add(title, (irow, 0), (1, 4), LEFT) sview = self.wids['stats'] = dv.DataViewListCtrl(panel, style=DVSTYLE) sview.Bind(dv.EVT_DATAVIEW_SELECTION_CHANGED, self.onSelectFit) sview.AppendTextColumn(' Fit #', width=50) sview.AppendTextColumn(' N_data', width=50) sview.AppendTextColumn(' N_vary', width=50) sview.AppendTextColumn(' N_eval', width=60) sview.AppendTextColumn(' \u03c7\u00B2', width=110) sview.AppendTextColumn(' \u03c7\u00B2_reduced', width=110) sview.AppendTextColumn(' Akaike Info', width=110) sview.AppendTextColumn(' Bayesian Info', width=110) for col in range(sview.ColumnCount): this = sview.Columns[col] isort, align = True, wx.ALIGN_RIGHT if col == 0: align = wx.ALIGN_CENTER this.Sortable = isort this.Alignment = this.Renderer.Alignment = align sview.SetMinSize((700, 125)) irow += 1 sizer.Add(sview, (irow, 0), (1, 5), LEFT) irow += 1 sizer.Add(HLine(panel, size=(650, 3)), (irow, 0), (1, 5), LEFT) irow += 1 title = SimpleText(panel, '[[Variables]]', font=Font(FONTSIZE+2), colour=self.colors.title, style=LEFT) sizer.Add(title, (irow, 0), (1, 1), LEFT) self.wids['copy_params'] = Button(panel, 'Update Model with these values', size=(250, -1), action=self.onCopyParams) sizer.Add(self.wids['copy_params'], (irow, 1), (1, 3), LEFT) pview = self.wids['params'] = dv.DataViewListCtrl(panel, style=DVSTYLE) self.wids['paramsdata'] = [] pview.AppendTextColumn('Parameter', width=150) pview.AppendTextColumn('Best-Fit Value', width=125) pview.AppendTextColumn('Standard Error', width=125) pview.AppendTextColumn('Info ', width=275) for col in range(4): this = pview.Columns[col] align = wx.ALIGN_LEFT if col in (1, 2): align = wx.ALIGN_RIGHT this.Sortable = False this.Alignment = this.Renderer.Alignment = align pview.SetMinSize((700, 200)) pview.Bind(dv.EVT_DATAVIEW_SELECTION_CHANGED, self.onSelectParameter) irow += 1 sizer.Add(pview, (irow, 0), (1, 5), LEFT) irow += 1 sizer.Add(HLine(panel, size=(650, 3)), (irow, 0), (1, 5), LEFT) irow += 1 title = SimpleText(panel, '[[Correlations]]', font=Font(FONTSIZE+2), colour=self.colors.title, style=LEFT) self.wids['all_correl'] = Button(panel, 'Show All', size=(100, -1), action=self.onAllCorrel) self.wids['min_correl'] = FloatSpin(panel, value=MIN_CORREL, min_val=0, size=(100, -1), digits=3, increment=0.1) ctitle = SimpleText(panel, 'minimum correlation: ') sizer.Add(title, (irow, 0), (1, 1), LEFT) sizer.Add(ctitle, (irow, 1), (1, 1), LEFT) sizer.Add(self.wids['min_correl'], (irow, 2), (1, 1), LEFT) sizer.Add(self.wids['all_correl'], (irow, 3), (1, 1), LEFT) irow += 1 cview = self.wids['correl'] = dv.DataViewListCtrl(panel, style=DVSTYLE) cview.AppendTextColumn('Parameter 1', width=150) cview.AppendTextColumn('Parameter 2', width=150) cview.AppendTextColumn('Correlation', width=150) for col in (0, 1, 2): this = cview.Columns[col] this.Sortable = False align = wx.ALIGN_LEFT if col == 2: align = wx.ALIGN_RIGHT this.Alignment = this.Renderer.Alignment = align cview.SetMinSize((475, 200)) irow += 1 sizer.Add(cview, (irow, 0), (1, 5), LEFT) irow += 1 sizer.Add(HLine(panel, size=(400, 3)), (irow, 0), (1, 5), LEFT) pack(panel, sizer) panel.SetupScrolling() mainsizer = wx.BoxSizer(wx.VERTICAL) mainsizer.Add(panel, 1, wx.GROW|wx.ALL, 1) pack(self, mainsizer) self.Show() self.Raise()