def FloatSpinWithPin(parent, value=0, pin_action=None, **kws): """create a FloatSpin with Pin button with action""" tooltip = 'use last point selected from plot' fspin = FloatSpin(parent, value=value, **kws) bmbtn = wx.BitmapButton(parent, id=-1, bitmap=get_icon('pin'), size=(25, 25)) if pin_action is not None: parent.Bind(wx.EVT_BUTTON, pin_action, bmbtn) if is_wxPhoenix: bmbtn.SetToolTip(tooltip) else: bmbtn.SetToolTipString(tooltip) return fspin, bmbtn
def __init__(self): wx.Frame.__init__(self, None, -1, 'wxutil demo', style=wx.DEFAULT_FRAME_STYLE|wx.RESIZE_BORDER|wx.TAB_TRAVERSAL) self.SetTitle('wxutil demo') self.SetFont(Font(11)) self.set_menu() self.statusbar = self.CreateStatusBar(2, 1) self.statusbar.SetStatusWidths([-2, -1]) statusbar_fields = ['Initializing....', ' '] for i in range(len(statusbar_fields)): self.statusbar.SetStatusText(statusbar_fields[i], i) self.Bind(wx.EVT_CLOSE, self.onExit) panel = GridPanel(self, nrows=8, ncols=4) tctrl_name = TextCtrl(panel, value='', action=self.onName, size=(250, -1)) lctrl_addr = LabeledTextCtrl(self, value='<>', action=self.onAddr, labeltext=' Address: ', size=(250, -1)) lab3 = HyperText(panel,' FloatCtrl: ', size=(100, -1), action=self.onHyperText) val3 = FloatCtrl(panel, '3', action=self.onFloat1, precision=2, minval=0, maxval=1000, size=(250, -1)) lab4 = HyperText(panel,' FloatSpin: ', size=(100, -1), action=self.onHyperText) val4 = FloatSpin(panel, '12.2', action=self.onFloatSpin, digits=2, increment=0.1, size=(250, -1)) labx = HyperText(panel,' NumericCombo: ', size=(100, -1), action=self.onHyperText) steps = make_steps(prec=1, tmin=0, tmax=100) valx = NumericCombo(panel, steps, precision=1) self.choice1 = Choice(panel, size=(200, -1),action=self.onChoice) self.choice1.SetChoices(['Apple', 'Banana', 'Cherry']) yesno = YesNo(panel) check1 = Check(panel, label='enable? ', action=self.onCheck) btn1 = Button(panel, label='Start', size=(100, -1), action=self.onStart) pinbtn = BitmapButton(panel, get_icon('pin'), size=(50, -1), action=partial(self.onBMButton, opt='pin1'), tooltip='use last point selected from plot') togbtn = ToggleButton(panel, 'Press Me', action=self.onToggleButton, size=(100, -1), tooltip='do it, do it now, you will like it') browse_btn = Button(panel, 'Open File', action=self.onFileOpen, size=(150, -1)) okcancel = OkCancel(panel, onOK=self.onOK, onCancel=self.onCancel) ptable_btn = Button(panel, 'Show Periodic Table', action=self.onPTable, size=(175, -1)) edlist_btn = Button(panel, 'Show Editable Listbox', action=self.onEdList, size=(175, -1)) filelist_btn = Button(panel, 'Show File CheckList', action=self.onFileList, size=(175, -1)) panel.AddText(' Name: ', style=LEFT) panel.Add(tctrl_name, dcol=2) panel.Add(lctrl_addr.label, newrow=True) panel.Add(lctrl_addr, dcol=2) panel.Add(lab3, newrow=True) panel.Add(val3, dcol=3) panel.Add(lab4, newrow=True) panel.Add(val4, dcol=3) panel.Add(labx, newrow=True) panel.Add(valx, dcol=3) panel.AddText(' Choice : ', newrow=True) panel.Add(check1) panel.Add(self.choice1) panel.AddText(' Yes or No: ', newrow=True) panel.Add(yesno) panel.Add(HLine(panel, size=(500, -1)), dcol=3, newrow=True) panel.Add(btn1, newrow=True) panel.Add(pinbtn) panel.Add(togbtn) panel.Add(browse_btn, newrow=True) panel.Add(ptable_btn) panel.Add(edlist_btn, newrow=True) panel.Add(filelist_btn) panel.Add(okcancel, newrow=True) panel.pack() self.timer = wx.Timer(self) self.last_time = time.time() self.Bind(wx.EVT_TIMER, self.onTimer, self.timer) fsizer = wx.BoxSizer(wx.VERTICAL) fsizer.Add(panel, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER|wx.EXPAND) wx.CallAfter(self.init_timer) psize = panel.GetBestSize() self.SetSize((psize[0]+5, psize[1]+25)) pack(self, fsizer) self.Refresh()
def createControlPanel(self): ctrlpanel = wx.Panel(self, name='Ctrl Panel') ptable = PeriodicTablePanel(ctrlpanel, onselect=self.onShowLines, tooltip_msg='Select Element for KLM Lines') self.wids['ptable'] = ptable labstyle = wx.ALIGN_LEFT|wx.ALIGN_BOTTOM|wx.EXPAND ctrlstyle = wx.ALIGN_LEFT|wx.ALIGN_BOTTOM txtstyle=wx.ALIGN_LEFT|wx.ST_NO_AUTORESIZE|wx.TE_PROCESS_ENTER Font9 = Font(9) Font10 = Font(10) Font11 = Font(11) # arrowpanel = wx.Panel(ctrlpanel) ssizer = wx.BoxSizer(wx.HORIZONTAL) for wname, dname in (('uparrow', 'up'), ('leftarrow', 'left'), ('rightarrow', 'right'), ('downarrow', 'down')): self.wids[wname] = wx.BitmapButton(arrowpanel, -1, get_icon(wname), size=(40, 40), style=wx.NO_BORDER) self.wids[wname].Bind(wx.EVT_BUTTON, partial(ptable.onKey, name=dname)) ssizer.Add(self.wids[wname], 0, wx.EXPAND|wx.ALL) self.wids['kseries'] = Check(arrowpanel, ' K ', action=self.onKLM) self.wids['lseries'] = Check(arrowpanel, ' L ', action=self.onKLM) self.wids['mseries'] = Check(arrowpanel, ' M ', action=self.onKLM) ssizer.Add(txt(arrowpanel, ' '), 0, wx.EXPAND|wx.ALL, 0) ssizer.Add(self.wids['kseries'], 0, wx.EXPAND|wx.ALL, 0) ssizer.Add(self.wids['lseries'], 0, wx.EXPAND|wx.ALL, 0) ssizer.Add(self.wids['mseries'], 0, wx.EXPAND|wx.ALL, 0) pack(arrowpanel, ssizer) # roi section... rsizer = wx.GridBagSizer(4, 6) roipanel = wx.Panel(ctrlpanel, name='ROI Panel') self.wids['roilist'] = wx.ListBox(roipanel, size=(135, 120)) self.wids['roilist'].Bind(wx.EVT_LISTBOX, self.onROI) self.wids['roilist'].SetMinSize((135, 120)) self.wids['roiname'] = wx.TextCtrl(roipanel, -1, '', size=(150, -1)) # roibtns= wx.Panel(roipanel, name='ROIButtons') zsizer = wx.BoxSizer(wx.HORIZONTAL) z1 = Button(roibtns, 'Add', size=(70, 30), action=self.onNewROI) z2 = Button(roibtns, 'Delete', size=(70, 30), action=self.onConfirmDelROI) z3 = Button(roibtns, 'Rename', size=(70, 30), action=self.onRenameROI) zsizer.Add(z1, 0, wx.EXPAND|wx.ALL, 0) zsizer.Add(z2, 0, wx.EXPAND|wx.ALL, 0) zsizer.Add(z3, 0, wx.EXPAND|wx.ALL, 0) pack(roibtns, zsizer) rt1 = txt(roipanel, ' Channels:', size=75, font=Font9) rt2 = txt(roipanel, ' Energy:', size=75, font=Font9) rt3 = txt(roipanel, ' Cen/Wid:', size=75, font=Font9) m = '' self.wids['roi_msg1'] = txt(roipanel, m, size=135, font=Font9) self.wids['roi_msg2'] = txt(roipanel, m, size=135, font=Font9) self.wids['roi_msg3'] = txt(roipanel, m, size=135, font=Font9) rsizer.Add(txt(roipanel, ' Regions of Interest:', size=125, font=Font11), (0, 0), (1, 3), labstyle) rsizer.Add(self.wids['roiname'], (1, 0), (1, 3), labstyle) rsizer.Add(roibtns, (2, 0), (1, 3), labstyle) rsizer.Add(rt1, (3, 0), (1, 1), LEFT) rsizer.Add(rt2, (4, 0), (1, 1), LEFT) rsizer.Add(rt3, (5, 0), (1, 1), LEFT) rsizer.Add(self.wids['roi_msg1'], (3, 1), (1, 2), labstyle) rsizer.Add(self.wids['roi_msg2'], (4, 1), (1, 2), labstyle) rsizer.Add(self.wids['roi_msg3'], (5, 1), (1, 2), labstyle) rsizer.Add(self.wids['roilist'], (0, 3), (6, 1), wx.EXPAND|wx.ALL|wx.ALIGN_RIGHT) rsizer.SetHGap(1) pack(roipanel, rsizer) # end roi section # y scale yscalepanel = wx.Panel(ctrlpanel, name='YScalePanel') ysizer = wx.BoxSizer(wx.HORIZONTAL) ytitle = txt(yscalepanel, ' Y Axis:', font=Font10, size=80) yspace = txt(yscalepanel, ' ', font=Font10, size=20) ylog = Choice(yscalepanel, size=(80, 30), choices=['log', 'linear'], action=self.onLogLinear) yaxis = Check(yscalepanel, ' Show Y Scale ', action=self.onYAxis, default=False) self.wids['show_yaxis'] = yaxis ysizer.Add(ytitle, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 0) ysizer.Add(ylog, 0, wx.EXPAND|wx.ALL, 0) ysizer.Add(yspace, 0, wx.EXPAND|wx.ALL, 0) ysizer.Add(yaxis, 0, wx.EXPAND|wx.ALL, 0) pack(yscalepanel, ysizer) # zoom buttons zoompanel = wx.Panel(ctrlpanel, name='ZoomPanel') zsizer = wx.BoxSizer(wx.HORIZONTAL) z1 = Button(zoompanel, 'Zoom In', size=(80, 30), action=self.onZoomIn) z2 = Button(zoompanel, 'Zoom Out', size=(80, 30), action=self.onZoomOut) p1 = Button(zoompanel, 'Pan Lo', size=(75, 30), action=self.onPanLo) p2 = Button(zoompanel, 'Pan Hi', size=(75, 30), action=self.onPanHi) zsizer.Add(p1, 0, wx.EXPAND|wx.ALL, 0) zsizer.Add(p2, 0, wx.EXPAND|wx.ALL, 0) zsizer.Add(z1, 0, wx.EXPAND|wx.ALL, 0) zsizer.Add(z2, 0, wx.EXPAND|wx.ALL, 0) pack(zoompanel, zsizer) # self.wids['xray_lines'] = None if HAS_DV: dvstyle = dv.DV_SINGLE|dv.DV_VERT_RULES|dv.DV_ROW_LINES xlines = dv.DataViewListCtrl(ctrlpanel, style=dvstyle) self.wids['xray_lines'] = xlines xlines.AppendTextColumn('Line ', width=55) xlines.AppendTextColumn('Energy(keV) ', width=110) xlines.AppendTextColumn('Strength ', width=85) xlines.AppendTextColumn('Levels ', width=75) for col in (0, 1, 2, 3): this = xlines.Columns[col] this.Sortable = True align = RIGHT if col in (0, 3): align = wx.ALIGN_LEFT this.Alignment = this.Renderer.Alignment = align xlines.SetMinSize((300, 240)) xlines.Bind(dv.EVT_DATAVIEW_SELECTION_CHANGED, self.onSelectXrayLine) # main layout # may have to adjust comparison.... store = xlines.GetStore() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(roipanel, 0, labstyle) sizer.Add(lin(ctrlpanel, 195), 0, labstyle) sizer.Add(yscalepanel, 0, wx.ALIGN_RIGHT|wx.EXPAND|wx.ALL) sizer.Add(zoompanel, 0, wx.ALIGN_RIGHT|wx.EXPAND|wx.ALL) sizer.Add(lin(ctrlpanel, 195), 0, labstyle) sizer.Add(ptable, 0, wx.ALIGN_RIGHT|wx.EXPAND|wx.ALL, 4) sizer.Add(arrowpanel, 0, labstyle) sizer.Add(lin(ctrlpanel, 195), 0, labstyle) if self.wids['xray_lines'] is not None: sizer.Add(xlines, 0, wx.ALIGN_CENTER|wx.GROW|wx.ALL|wx.EXPAND) pack(ctrlpanel, sizer) return ctrlpanel
def createControlPanel(self): ctrlpanel = wx.Panel(self, name='Ctrl Panel') ptable = PeriodicTablePanel(ctrlpanel, onselect=self.onShowLines, tooltip_msg='Select Element for KLM Lines') self.wids['ptable'] = ptable labstyle = wx.ALIGN_LEFT|wx.ALIGN_BOTTOM|wx.EXPAND ctrlstyle = wx.ALIGN_LEFT|wx.ALIGN_BOTTOM txtstyle=wx.ALIGN_LEFT|wx.ST_NO_AUTORESIZE|wx.TE_PROCESS_ENTER Font9 = Font(9) Font10 = Font(10) Font11 = Font(11) # arrowpanel = wx.Panel(ctrlpanel) ssizer = wx.BoxSizer(wx.HORIZONTAL) for wname, dname in (('uparrow', 'up'), ('leftarrow', 'left'), ('rightarrow', 'right'), ('downarrow', 'down')): self.wids[wname] = wx.BitmapButton(arrowpanel, -1, get_icon(wname), size=(25, 25), style=wx.NO_BORDER) self.wids[wname].Bind(wx.EVT_BUTTON, partial(ptable.onKey, name=dname)) ssizer.Add(self.wids[wname], 0, wx.EXPAND|wx.ALL) self.wids['kseries'] = Check(arrowpanel, ' K ', action=self.onKLM) self.wids['lseries'] = Check(arrowpanel, ' L ', action=self.onKLM) self.wids['mseries'] = Check(arrowpanel, ' M ', action=self.onKLM) self.wids['holdbtn'] = wx.ToggleButton(arrowpanel, -1, 'Hold ', size=(65, 25)) self.wids['holdbtn'].Bind(wx.EVT_TOGGLEBUTTON, self.onToggleHold) ssizer.Add(txt(arrowpanel, ' '), 0, wx.EXPAND|wx.ALL, 0) ssizer.Add(self.wids['holdbtn'], 0, wx.EXPAND|wx.ALL, 2) ssizer.Add(self.wids['kseries'], 0, wx.EXPAND|wx.ALL, 0) ssizer.Add(self.wids['lseries'], 0, wx.EXPAND|wx.ALL, 0) ssizer.Add(self.wids['mseries'], 0, wx.EXPAND|wx.ALL, 0) pack(arrowpanel, ssizer) # roi section... rsizer = wx.GridBagSizer(4, 6) roipanel = wx.Panel(ctrlpanel, name='ROI Panel') self.wids['roilist'] = wx.ListBox(roipanel, size=(135, 120)) self.wids['roilist'].Bind(wx.EVT_LISTBOX, self.onROI) self.wids['roilist'].SetMinSize((135, 120)) self.wids['roiname'] = wx.TextCtrl(roipanel, -1, '', size=(150, -1)) # roibtns= wx.Panel(roipanel, name='ROIButtons') zsizer = wx.BoxSizer(wx.HORIZONTAL) z1 = Button(roibtns, 'Add', size=(70, 30), action=self.onNewROI) z2 = Button(roibtns, 'Delete', size=(70, 30), action=self.onConfirmDelROI) z3 = Button(roibtns, 'Rename', size=(70, 30), action=self.onRenameROI) zsizer.Add(z1, 0, wx.EXPAND|wx.ALL, 0) zsizer.Add(z2, 0, wx.EXPAND|wx.ALL, 0) zsizer.Add(z3, 0, wx.EXPAND|wx.ALL, 0) pack(roibtns, zsizer) rt1 = txt(roipanel, ' Channels:', size=75, font=Font9) rt2 = txt(roipanel, ' Energy:', size=75, font=Font9) rt3 = txt(roipanel, ' Cen/Wid:', size=75, font=Font9) m = '' self.wids['roi_msg1'] = txt(roipanel, m, size=135, font=Font9) self.wids['roi_msg2'] = txt(roipanel, m, size=135, font=Font9) self.wids['roi_msg3'] = txt(roipanel, m, size=135, font=Font9) rsizer.Add(txt(roipanel, ' Regions of Interest:', size=125, font=Font11), (0, 0), (1, 3), labstyle) rsizer.Add(self.wids['roiname'], (1, 0), (1, 3), labstyle) rsizer.Add(roibtns, (2, 0), (1, 3), labstyle) rsizer.Add(rt1, (3, 0), (1, 1), LEFT) rsizer.Add(rt2, (4, 0), (1, 1), LEFT) rsizer.Add(rt3, (5, 0), (1, 1), LEFT) rsizer.Add(self.wids['roi_msg1'], (3, 1), (1, 2), labstyle) rsizer.Add(self.wids['roi_msg2'], (4, 1), (1, 2), labstyle) rsizer.Add(self.wids['roi_msg3'], (5, 1), (1, 2), labstyle) rsizer.Add(self.wids['roilist'], (0, 3), (6, 1), wx.EXPAND|wx.ALL|wx.ALIGN_RIGHT) rsizer.SetHGap(1) pack(roipanel, rsizer) # end roi section # y scale yscalepanel = wx.Panel(ctrlpanel, name='YScalePanel') ysizer = wx.BoxSizer(wx.HORIZONTAL) ytitle = txt(yscalepanel, ' Y Axis:', font=Font10, size=80) yspace = txt(yscalepanel, ' ', font=Font10, size=20) ylog = Choice(yscalepanel, size=(80, 30), choices=['log', 'linear'], action=self.onLogLinear) yaxis = Check(yscalepanel, ' Show Y Scale ', action=self.onYAxis, default=False) self.wids['show_yaxis'] = yaxis ysizer.Add(ytitle, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 0) ysizer.Add(ylog, 0, wx.EXPAND|wx.ALL, 0) ysizer.Add(yspace, 0, wx.EXPAND|wx.ALL, 0) ysizer.Add(yaxis, 0, wx.EXPAND|wx.ALL, 0) pack(yscalepanel, ysizer) # zoom buttons zoompanel = wx.Panel(ctrlpanel, name='ZoomPanel') zsizer = wx.BoxSizer(wx.HORIZONTAL) z1 = Button(zoompanel, 'Zoom In', size=(80, 30), action=self.onZoomIn) z2 = Button(zoompanel, 'Zoom Out', size=(80, 30), action=self.onZoomOut) p1 = Button(zoompanel, 'Pan Lo', size=(75, 30), action=self.onPanLo) p2 = Button(zoompanel, 'Pan Hi', size=(75, 30), action=self.onPanHi) zsizer.Add(p1, 0, wx.EXPAND|wx.ALL, 0) zsizer.Add(p2, 0, wx.EXPAND|wx.ALL, 0) zsizer.Add(z1, 0, wx.EXPAND|wx.ALL, 0) zsizer.Add(z2, 0, wx.EXPAND|wx.ALL, 0) pack(zoompanel, zsizer) # self.wids['xray_lines'] = None if HAS_DV: dvstyle = dv.DV_SINGLE|dv.DV_VERT_RULES|dv.DV_ROW_LINES xlines = dv.DataViewListCtrl(ctrlpanel, style=dvstyle) self.wids['xray_lines'] = xlines xlines.AppendTextColumn('Line ', width=55) xlines.AppendTextColumn('Energy(keV) ', width=110) xlines.AppendTextColumn('Strength ', width=85) xlines.AppendTextColumn('Levels ', width=75) for col in (0, 1, 2, 3): this = xlines.Columns[col] this.Sortable = True align = RIGHT if col in (0, 3): align = wx.ALIGN_LEFT this.Alignment = this.Renderer.Alignment = align xlines.SetMinSize((300, 240)) xlines.Bind(dv.EVT_DATAVIEW_SELECTION_CHANGED, self.onSelectXrayLine) # main layout # may have to adjust comparison.... store = xlines.GetStore() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(roipanel, 0, labstyle) sizer.Add(lin(ctrlpanel, 195), 0, labstyle) sizer.Add(yscalepanel, 0, wx.ALIGN_RIGHT|wx.EXPAND|wx.ALL) sizer.Add(zoompanel, 0, wx.ALIGN_RIGHT|wx.EXPAND|wx.ALL) sizer.Add(lin(ctrlpanel, 195), 0, labstyle) sizer.Add(ptable, 0, wx.ALIGN_RIGHT|wx.EXPAND|wx.ALL, 4) sizer.Add(arrowpanel, 0, labstyle) sizer.Add(lin(ctrlpanel, 195), 0, labstyle) if self.wids['xray_lines'] is not None: sizer.Add(xlines, 0, wx.ALIGN_CENTER|wx.GROW|wx.ALL|wx.EXPAND) pack(ctrlpanel, sizer) return ctrlpanel
def __init__(self): wx.Frame.__init__(self, None, -1, 'wxutil demo', style=wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER | wx.TAB_TRAVERSAL) self.SetTitle('wxutil demo') self.SetFont(Font(11)) self.set_menu() self.statusbar = self.CreateStatusBar(2, 1) self.statusbar.SetStatusWidths([-2, -1]) statusbar_fields = ['Initializing....', ' '] for i in range(len(statusbar_fields)): self.statusbar.SetStatusText(statusbar_fields[i], i) self.Bind(wx.EVT_CLOSE, self.onExit) panel = GridPanel(self, nrows=8, ncols=4) tctrl_name = TextCtrl(panel, value='', action=self.onName, size=(250, -1)) lctrl_addr = LabeledTextCtrl(self, value='<>', action=self.onAddr, labeltext=' Address: ', size=(250, -1)) lab3 = HyperText(panel, ' FloatCtrl: ', size=(100, -1), action=self.onHyperText) val3 = FloatCtrl(panel, '3', action=self.onFloat1, precision=2, minval=0, maxval=1000, size=(250, -1)) lab4 = HyperText(panel, ' FloatSpin: ', size=(100, -1), action=self.onHyperText) val4 = FloatSpin(panel, '12.2', action=self.onFloatSpin, digits=2, increment=0.1, size=(250, -1)) labx = HyperText(panel, ' NumericCombo: ', size=(100, -1), action=self.onHyperText) steps = make_steps(prec=1, tmin=0, tmax=100) valx = NumericCombo(panel, steps, precision=1) self.choice1 = Choice(panel, size=(200, -1), action=self.onChoice) self.choice1.SetChoices(['Apple', 'Banana', 'Cherry']) yesno = YesNo(panel) check1 = Check(panel, label='enable? ', action=self.onCheck) btn1 = Button(panel, label='Start', size=(100, -1), action=self.onStart) pinbtn = BitmapButton(panel, get_icon('pin'), size=(50, -1), action=partial(self.onBMButton, opt='pin1'), tooltip='use last point selected from plot') togbtn = ToggleButton(panel, 'Press Me', action=self.onToggleButton, size=(100, -1), tooltip='do it, do it now, you will like it') browse_btn = Button(panel, 'Open File', action=self.onFileOpen, size=(150, -1)) okcancel = OkCancel(panel, onOK=self.onOK, onCancel=self.onCancel) ptable_btn = Button(panel, 'Show Periodic Table', action=self.onPTable, size=(175, -1)) edlist_btn = Button(panel, 'Show Editable Listbox', action=self.onEdList, size=(175, -1)) filelist_btn = Button(panel, 'Show File CheckList', action=self.onFileList, size=(175, -1)) panel.AddText(' Name: ', style=LEFT) panel.Add(tctrl_name, dcol=2) panel.Add(lctrl_addr.label, newrow=True) panel.Add(lctrl_addr, dcol=2) panel.Add(lab3, newrow=True) panel.Add(val3, dcol=3) panel.Add(lab4, newrow=True) panel.Add(val4, dcol=3) panel.Add(labx, newrow=True) panel.Add(valx, dcol=3) panel.AddText(' Choice : ', newrow=True) panel.Add(check1) panel.Add(self.choice1) panel.AddText(' Yes or No: ', newrow=True) panel.Add(yesno) panel.Add(HLine(panel, size=(500, -1)), dcol=3, newrow=True) panel.Add(btn1, newrow=True) panel.Add(pinbtn) panel.Add(togbtn) panel.Add(browse_btn, newrow=True) panel.Add(ptable_btn) panel.Add(edlist_btn, newrow=True) panel.Add(filelist_btn) panel.Add(okcancel, newrow=True) panel.pack() self.timer = wx.Timer(self) self.last_time = time.time() self.Bind(wx.EVT_TIMER, self.onTimer, self.timer) fsizer = wx.BoxSizer(wx.VERTICAL) fsizer.Add(panel, 0, LEFT | wx.EXPAND) wx.CallAfter(self.init_timer) psize = panel.GetBestSize() self.SetSize((psize[0] + 5, psize[1] + 25)) pack(self, fsizer) self.Refresh()