A couple of sizing questions, O Helpful Ones:
(1) How do I get the panel in each of the four windows to fill the
window?
(2) How do I get the four windows to fill the frame again when the user
resizes the frame?
···
`import wx
class MainFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self,
parent, -1, title)
pnl = wx.Panel(self,-1)
gbs =
wx.GridBagSizer(1,1)
win00 =
gbs.Add(ChildWindow0(pnl, -1)
,(0,0),flag=wx.EXPAND)
win01 =
gbs.Add(ChildWindow1(pnl, -1,‘win01’),(0,1),flag=wx.EXPAND)
win10 =
gbs.Add(ChildWindow1(pnl, -1,‘win10’),(1,0),flag=wx.EXPAND)
win11 =
gbs.Add(ChildWindow1(pnl, -1,‘win11’),(1,1),flag=wx.EXPAND)
pnl.SetSizerAndFit(gbs)
self.SetClientSize(pnl.GetSize())
class ChildWindow0(wx.Window):
def __init__(self, parent, id):
wx.Window.__init__(self,
parent, -1, size=(300,300), style=wx.RAISED_BORDER)
pnl = wx.Panel(self,-1)
self.SetClientSize(pnl.GetSize())
pnl.SetBackgroundColour(wx.BLUE)
class ChildWindow1(wx.Window):
def __init__(self, parent, id, title):
wx.Window.__init__(self,
parent, -1, size=(300,300), style=wx.RAISED_BORDER)
pnl = wx.Panel(self,-1)
pnl.SetBackgroundColour(wx.BLUE)
st_ttl = wx.StaticText(pnl,
-1, “(window title)” , size=(300,20)
, style=wx.ALIGN_CENTER|wx.RAISED_BORDER|wx.ST_NO_AUTORESIZE)
st_ttl.SetBackgroundColour(wx.WHITE)
bs =
wx.BoxSizer(wx.VERTICAL)
bs.Add(st_ttl , 0,
wx.EXPAND,0,0)
bs.Add((100,50), 1,
wx.BORDER,0,0)
pnl.SetSizerAndFit(bs)
if name == ‘main’:
app = wx.App(redirect=False)
frame = MainFrame(None, -1, "Windows in panel in
frame test")
frame.Show()
app.MainLoop()
`
Bob