OK, let me try again. Here's a similar example using a grid bag sizer. The code creates four child frames, and the parent panel resizes to hold them, but it doesn't actually hold them; where they display has nothing to do with where the main frame and panel are.
What do I need to do to this code so that the panel actually =contains= the child frames?
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(2, 2)
win1 = gbs.Add(ChildFrame(pnl, -1,"win1"),(0,0),flag=wx.EXPAND)
win2 = gbs.Add(ChildFrame(pnl, -1,"win2"),(0,1),flag=wx.EXPAND)
win3 = gbs.Add(ChildFrame(pnl, -1,"win3"),(1,0),flag=wx.EXPAND)
win4 = gbs.Add(ChildFrame(pnl, -1,"win4"),(1,1),flag=wx.EXPAND)
pnl.SetSizerAndFit(gbs)
self.SetClientSize(pnl.GetSize())
class ChildFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, -1, title, size = (300, 300))
self.Show(True)
if __name__ == '__main__':
app = wx.App(redirect=False)
frame = MainFrame(None, -1, "Frame in frame test")
frame.Show()
app.MainLoop()
Bob
···
Date: Tue, 24 Oct 2006 22:40:38 -0400
To: wxPython-users@lists.wxwidgets.org
From: Bob Klahn <bobstones@comcast.net>
Subject: [wxPython-users] Newbie frame-in-frame questionA VERY basic question: What do I need to add or change to get the child frames inside the panel?
import wx
class MainFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, -1, title)
pnl = wx.Panel(self,-1)
win1 = ChildFrame(pnl, -1, "win 1")
win2 = ChildFrame(pnl, -1, "win 2")class ChildFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, -1, title, size = (300, 300))
self.Show(True)if __name__ == '__main__':
app = wx.App(redirect=False)
frame = MainFrame(None, -1, "Frame in frame test")
frame.Show()
app.MainLoop()Bob
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.0.408 / Virus Database: 268.13.11/494 - Release Date: 10/24/2006---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.0.408 / Virus Database: 268.13.11/494 - Release Date: 10/24/2006
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.0.408 / Virus Database: 268.13.11/494 - Release Date: 10/24/2006