Hi,
Would anyone know if it is possible to have a wx element with minimum
and maximum sizes set (SetMinSize() and SetMaxSize()), as well as
being proportional (Add(item, proportion=1)) when one of these
boundaries has not been encountered? Below is an example where I
would like the blue panel to have this property, while the other
elements below it are either fixed or proportional. Is there a way of
doing this without coming up with a custom layout algorithm? Any
suggestions would be much appreciated.
Cheers,
Edward
#!/usr/bin/env python
import wx
class MyFrame(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
sizer = wx.BoxSizer(wx.VERTICAL)
# Blue panel (min of 100, max of 300, and proportional).
panel = wx.Panel(self, -1)
panel.SetBackgroundColour("Blue")
panel.SetMinSize((-1, 100))
panel.SetMaxSize((-1, 300))
sizer.Add(panel, 2, wx.ALL|wx.EXPAND, 0)
# Red panel (fixed size).
panel = wx.Panel(self, -1)
panel.SetBackgroundColour("Red")
panel.SetSize((-1, 50))
sizer.Add(panel, 0, wx.ALL|wx.EXPAND, 0)
# Green panel (proportional).
panel = wx.Panel(self, -1)
panel.SetBackgroundColour("Green")
sizer.Add(panel, 1, wx.ALL|wx.EXPAND, 0)
# Set the sizer.
self.SetSizer(sizer)
if __name__ == '__main__':
app = wx.App()
frame = MyFrame(None, title="My App")
frame.Show()
app.MainLoop()