Hi friends,

I have a custom tree control(Tree control) and a check list box placed next to each other on a frame.i.e., tree control on the left side of the frame and check list box on the right.

I need to place sizers such that on exapnsion of the frame, the tree control should only increase in vertical direction and the check list box should should increase in size both in the horizontal and vertical directions.

Currently : THe custom tree control is GETTING placed above the checklist box control after implementing sizers.

Please check the attachments.
Please help!!!....


Attachments Sizer.JPG 35.12 KB Sizer1.JPG 8.01 KB

you can use such flags as


#Here is an example
self.sizer.Add(self.Tree,proportion=1,flag = wx.TOP|wx.BOTTOM)
#Now that would only expand top and botton
# I cant remember if you need wx.EXPAND in there too....

to tell the sizers which ways it is allowed to expand.

I think Paul is right but cannot give 100% vote until I test it! If you post simple piece of code, it will be easy to play with code and re-post it modified; but if your codes are not closed source anyway!

This are the sizers I am using...

hsizer2 = wx.BoxSizer(wx.HORIZONTAL)
hsizer2 = wx.FlexGridSizer(cols=1, hgap=5, vgap=5)

hsizer2.Add(self.customTree,1,wx.EXPAND | wx.ALIGN_LEFT,2)
hsizer2.Add(self.chkLstBox, 1,wx.EXPAND | wx.ALIGN_RIGHT,2)

b = 5
vsizer2 = wx.BoxSizer(wx.VERTICAL)
vsizer2.Add(hsizer2, 1, wx.EXPAND | wx.ALL, b)

#get the size of the main frame
r = self.GetSize()
#set the minimal size of the main frame

With the above piece of code, the tree control and check list box are being place one above the other(See attachment). But I want them to be placed next to each other.

Please help!!!


Thanks a lot... It's working now....
I removed the FlexGrid Sizer.....

Thanks again...


I also suggest that you give tree a proportion of 0 and the list box 1 so that only list box will expand to fill whole space and the tree will just take optimum space


This question has already been answered. Start a new discussion instead.