@@ -0,0 +1,2032 @@
+import wx%0Aimport random%0A%0A%0Adef randColor():%0A    r = random.randint(0, 255)%0A    g = random.randint(0, 255)%0A    b = random.randint(0, 255)%0A    return (r, g, b)%0A%0A%0Aclass TreeLayout(wx.Panel):%0A    def __init__(self, parent, id, text):%0A        wx.Panel.__init__(self, parent, id)%0A        self.SetBackgroundColour('#ededed')%0A        hbox = wx.BoxSizer(wx.HORIZONTAL)%0A        self.SetSizer(hbox)%0A%0A        contentPanel = wx.StaticText(self, -1, text, size=(50, 50))%0A%0A        self.subPanel = wx.Panel(self, -1)%0A        self.subPanel.SetBackgroundColour(randColor())%0A%0A        hbox.Add(contentPanel, 0, wx.EXPAND %7C wx.ALL, 2)%0A        hbox.Add(self.subPanel, 1, wx.EXPAND %7C wx.ALL, 2)%0A%0A        self.contents = wx.BoxSizer(wx.VERTICAL)%0A        self.subPanel.SetSizer(self.contents)%0A%0A%0Aclass TreeLayoutFrame(wx.Frame):%0A    def __init__(self, parent, id, title):%0A        wx.Frame.__init__(self, parent, id, title, size=(380, 200))%0A%0A        panel = wx.Panel(self, -1)%0A        panel.SetBackgroundColour(randColor())%0A        vbox = wx.BoxSizer(wx.VERTICAL)%0A%0A        midPan1 = TreeLayout(panel, -1, '1')%0A        midPan2 = TreeLayout(panel, -1, '2')%0A        midPan11 = TreeLayout(midPan1.subPanel, -1, '11')%0A        midPan21 = TreeLayout(midPan2.subPanel, -1, '21')%0A        midPan22 = TreeLayout(midPan2.subPanel, -1, '22')%0A        midPan23 = TreeLayout(midPan2.subPanel, -1, '22')%0A        midPan24 = TreeLayout(midPan2.subPanel, -1, '22')%0A        midPan1.contents.Add(midPan11, 1, wx.EXPAND %7C wx.ALL, 2)%0A        midPan2.contents.Add(midPan21, 1, wx.EXPAND %7C wx.ALL, 2)%0A        midPan2.contents.Add(midPan22, 1, wx.EXPAND %7C wx.ALL, 2)%0A        midPan2.contents.Add(midPan23, 1, wx.EXPAND %7C wx.ALL, 2)%0A        midPan2.contents.Add(midPan24, 1, wx.EXPAND %7C wx.ALL, 2)%0A%0A        vbox.Add(midPan1, 0, wx.EXPAND %7C wx.ALL, 2)%0A        vbox.Add(midPan2, 0, wx.EXPAND %7C wx.ALL, 2)%0A        panel.SetSizer(vbox)%0A        self.Centre()%0A        self.Show(True)%0A%0A%0Aif __name__ == '__main__':%0A    app = wx.App()%0A    TreeLayoutFrame(None, -1, 'layout.py')%0A    app.MainLoop()%0A

test script for TreeLayout