I have been working on (playing with) nested panels and nested
sizers, including wxStaticBoxSizers, so trying to answer your
question seemed like a good way to test my approach. This is not
necessarily the most efficient way (for example, there is reason to
create a separate ButtonPanel as I did, except to demonstrate
nesting panels), but the code that follows produces a frame that is
similar to what you requested. BTW I don't think it is possible to
put a checkbox IN the border of the static box.
from wxPython.wx import *
class CheckBoxPanel(wxPanel):
def __init__(self, parent, spacer=0, text=''):
wxPanel.__init__(self, parent, -1)
sizer = wxBoxSizer(wxHORIZONTAL)
sizer.Add(spacer, 5, 0, wxEXPAND)
sizer.Add(wxCheckBox(self, -1, text), 1, wxEXPAND|wxALL, 5)
sizer.Fit(self) # set panel to minimum size
self.SetAutoLayout(true) # tell frame to use sizer
self.SetSizer(sizer) # actually set the sizer
sizer.SetSizeHints(self) # set size hints, honor mininum
class ButtonPanel(wxPanel):
def __init__(self, parent, id=-1):
wxPanel.__init__(self, parent, id)
sizer = wxBoxSizer(wxHORIZONTAL)
sizer.Add(wxButton(self, -1, 'OK'), 1, wxEXPAND)
sizer.Add(wxButton(self, -1, 'Cancel'), 1, wxEXPAND)
sizer.Fit(self) # set panel to minimum size
self.SetAutoLayout(true) # tell frame to use sizer
self.SetSizer(sizer) # actually set the sizer
sizer.SetSizeHints(self) # set size hints, honor mininum
class TestPanel(wxPanel):
def __init__(self, parent, id=-1):
wxPanel.__init__(self, parent, id)
sizer = wxStaticBoxSizer(wxStaticBox(self, -1, 'Test',
style=wxSUNKEN_BORDER),
wxVERTICAL)
sizer.Add(CheckBoxPanel(self, 0, 'test'), 1, wxEXPAND)
sizer.Add(CheckBoxPanel(self, 20, 'subtest'), 1, wxEXPAND)
sizer.Add(CheckBoxPanel(self, 20, 'subtest'), 1, wxEXPAND)
sizer.Add(CheckBoxPanel(self, 20, 'subtest'), 1, wxEXPAND)
sizer.Fit(self) # set panel to minimum size
self.SetAutoLayout(true) # tell frame to use sizer
self.SetSizer(sizer) # actually set the sizer
sizer.SetSizeHints(self) # set size hints, honor mininum
class MyPanel(wxPanel):
def __init__(self, parent, id=-1):
wxPanel.__init__(self, parent, id)
sizer = wxBoxSizer(wxVERTICAL)
sizer.Add(TestPanel(self), 3, wxEXPAND)
sizer.Add(TestPanel(self), 3, wxEXPAND)
sizer.Add(TestPanel(self), 3, wxEXPAND)
sizer.Add(ButtonPanel(self), 1, wxEXPAND)
sizer.Fit(self) # set panel to minimum size
self.SetAutoLayout(true) # tell frame to use sizer
self.SetSizer(sizer) # actually set the sizer
sizer.SetSizeHints(self) # set size hints, honor mininum
class MyFrame(wxFrame):
def __init__(self):
wxFrame.__init__(self, None, -1, 'Test Suite')
sizer = wxBoxSizer(wxHORIZONTAL)
sizer.Add(MyPanel(self), 1, wxEXPAND)
sizer.Fit(self) # set frame to minimum size
self.SetAutoLayout(true) # tell frame to use sizer
self.SetSizer(sizer) # actually set the sizer
sizer.SetSizeHints(self) # set size hints, honor mininum
sizer.Layout()
class testApp(wxApp):
def OnInit(self):
main = MyFrame()
self.SetTopWindow(main)
main.Show(true)
return true
app = testApp(0)
app.MainLoop()
···
--- Przemys�aw G. Gawro�ski <P.Gawronski@obop.com.pl> wrote:
Hi
I'm to implement a dialog of (more less) such structure (a test
configuration):
<snip>
=====
Donnal Walter
Arkansas Children's Hospital
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage