[Boa Constr] setting sizers in Boa?
Status: Beta
Brought to you by:
riaan
From: RayS <rj...@bl...> - 2003-11-03 21:19:47
|
Just answered my own question. Open designer click containers/layout -> boxsizer click the panel to add to click sizers tab dbl-click boxsizer1 click new button go to inspector -> window, select a widget (plotCanvas, for me) in sizer pop-up, click 'more new' button add sizer click sizers tab dbl-click boxsizer2 click new button go to inspector -> window, select widgets highlight plotcCanvas in the sizer boxsizer1 pop-up window in properties, set proportion to 1, flag to wxExpand highlight boxSizer2 in the sizer boxsizer1 pop-up window in properties, set proportion to 0, flag to wxExpand highlight slider1 in the sizer boxsizer2 pop-up window in properties, set proportion to 1, flag to wxExpand save enjoy (then link slider methods to manipulate the plotCanvas's arrays and re-plot) Ray Sample code below: #Boa:Frame:wxFrame1 from wxPython.wx import * from wxPyPlot.wxPyPlot import PlotCanvas def create(parent): return wxFrame1(parent) [wxID_WXFRAME1, wxID_WXFRAME1CHOICE1, wxID_WXFRAME1NOTEBOOK1, wxID_WXFRAME1PANEL1, wxID_WXFRAME1PLOTCANVAS1, wxID_WXFRAME1SLIDER1, ] = map(lambda _init_ctrls: wxNewId(), range(6)) class wxFrame1(wxFrame): def _init_coll_boxSizer2_Items(self, parent): # generated method, don't edit parent.AddWindow(self.choice1, 0, border=0, flag=0) parent.AddWindow(self.slider1, 1, border=0, flag=wxEXPAND) def _init_coll_boxSizer1_Items(self, parent): # generated method, don't edit parent.AddWindow(self.plotCanvas1, 1, border=0, flag=wxEXPAND) parent.AddSizer(self.boxSizer2, 0, border=0, flag=wxEXPAND) def _init_coll_notebook1_Pages(self, parent): # generated method, don't edit parent.AddPage(imageId=-1, page=self.panel1, select=True, text='Pages0') def _init_sizers(self): # generated method, don't edit self.boxSizer1 = wxBoxSizer(orient=wxVERTICAL) self.boxSizer2 = wxBoxSizer(orient=wxHORIZONTAL) self._init_coll_boxSizer1_Items(self.boxSizer1) self._init_coll_boxSizer2_Items(self.boxSizer2) self.panel1.SetSizer(self.boxSizer1) def _init_ctrls(self, prnt): # generated method, don't edit wxFrame.__init__(self, id=wxID_WXFRAME1, name='', parent=prnt, pos=wxPoint(1238, 63), size=wxSize(700, 639), style=wxDEFAULT_FRAME_STYLE, title='wxFrame1') self.SetClientSize(wxSize(692, 612)) self.notebook1 = wxNotebook(id=wxID_WXFRAME1NOTEBOOK1, name='notebook1', parent=self, pos=wxPoint(0, 0), size=wxSize(692, 612), style=0) self.panel1 = wxPanel(id=wxID_WXFRAME1PANEL1, name='panel1', parent=self.notebook1, pos=wxPoint(0, 0), size=wxSize(684, 586), style=wxTAB_TRAVERSAL) self.slider1 = wxSlider(id=wxID_WXFRAME1SLIDER1, maxValue=100, minValue=0, name='slider1', parent=self.panel1, point=wxPoint(125, 564), size=wxSize(559, 22), style=wxSL_HORIZONTAL, value=50) self.slider1.SetLabel(u'') self.slider1.SetThemeEnabled(False) self.slider1.SetToolTipString(u'0 Percent') self.choice1 = wxChoice(choices=[], id=wxID_WXFRAME1CHOICE1, name='choice1', parent=self.panel1, pos=wxPoint(0, 564), size=wxSize(125, 21), style=0) self.plotCanvas1 = PlotCanvas(id=wxID_WXFRAME1PLOTCANVAS1, name='plotCanvas1', parent=self.panel1, pos=wxPoint(0, 0), size=wxSize(684, 564), style=0) self.plotCanvas1.SetAutoLayout(True) self._init_coll_notebook1_Pages(self.notebook1) self._init_sizers() def __init__(self, parent): self._init_ctrls(parent) #!/usr/bin/env python #Boa:App:BoaApp from wxPython.wx import * import wxFrame1 modules ={'wxFrame1': [1, 'Main frame of Application', u'wxFrame1.py']} class BoaApp(wxApp): def OnInit(self): wxInitAllImageHandlers() self.main = wxFrame1.create(None) # needed when running from Boa under Windows 9X self.main.Show() self.SetTopWindow(self.main) return True def main(): application = BoaApp(0) application.MainLoop() if __name__ == '__main__': main() |