[wxPython-users] Setting minimum size of a frame
Raffaello Barella
barbarossa.platz at gmail.com
Fri Jan 25 22:52:00 PST 2008
Try adding the following code:
in __init__
self.min_ClientHeight =3D self.GetClientSize().height
self.Bind(wx.EVT_SIZE, self.OnSize)
then
def OnSize(self, event):
event.Skip()
cl_size =3D self.GetClientSize()
if cl_size.height < self.min_ClientHeight:
self.SetClientSize((cl_size.width, self.min_ClientHeight))
2008/1/26, Aaron MacDonald <ajmacd at ns.sympatico.ca>:
>
> I'm having a little trouble setting the minimum size of a frame in my
> application. My frame contains a single panel subclass whose minimum
> size I've also set. This is how I initialize my frame.
>
> class MyFrame(wx.Frame):
> def __init__(self, parent, id, title):
> wx.Frame.__init__(self, parent, id, title)
>
> panel =3D MyPanel(self, -1)
>
> sizerH =3D wx.BoxSizer(wx.HORIZONTAL)
> sizerV =3D wx.BoxSizer(wx.VERTICAL)
>
> sizerH.Add(panel, 0)
> sizerV.Add(sizerH, 0, wx.EXPAND)
>
> sizerV.Fit(self)
> self.SetMinSize(sizerV.GetMinSize())
>
> This works...sort of. The frame is the right size on startup.
> However, it's still possible to resize the frame to have a slightly
> shorter height. I can't make the width smaller, only the height.
> Apparently, the minimum height of the frame includes the height of the
> title bar. What I want is for the frame to have a minimum size for
> the area below the title bar; basically shrink-wrapped around the
> interior panel. What do people suggest?
>
> Thank you,
>
> Aaron M.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200801=
26/04638e14/attachment.htm
More information about the wxpython-users
mailing list