BoxSizer: is it possible to give a min-size for an item with proportion > 0 ?

Hi,

I found that SetMinSize for a widget managed by a BoxSizer has only an effect when the proportion has a value > 0. Is there a way that min-size works for items with a proportion > 0 ?

In my example I want that the middle panel (widget1) can grow but it should not be smaller than the specified min-size.

import wx

class TestFrame(wx.Frame):

def init(self):

wx.Frame.init(self, None, -1, “Test”)

panel = wx.Panel(self, -1)

sizer = wx.BoxSizer(wx.VERTICAL)

panel.SetSizer(sizer)

widget0 = wx.Panel(panel, -1)

widget0.SetBackgroundColour(wx.RED)

widget0.SetMinSize((100,100))

sizer.Add(widget0, 0, wx.EXPAND)

widget1 = wx.Panel(panel, -1)

widget1.SetBackgroundColour(wx.BLUE)

widget1.SetMinSize((100,100))

sizer.Add(widget1, 1, wx.EXPAND)

widget2 = wx.Panel(panel, -1)

widget2.SetBackgroundColour(wx.GREEN)

widget2.SetMinSize((100,100))

sizer.Add(widget2, 0, wx.EXPAND)

app = wx.PySimpleApp()

TestFrame().Show()

app.MainLoop()

Erwin

I think you should call SetMinSize() or SetSizeHints() on the frame. Try adding some code like:

    outer = wx.BoxSizer(wx.VERTICAL)
    outer.Add(panel, 1, wx.EXPAND)
    self.SetSizer(outer)
    self.SetMinSize(self.GetBestSize())

Mark