min/max-size on wx.MSW

Hello,

I'm trying to create a frame with multiple controls. The should have an initial size (which is given on creation of the controls). Additionally the controls should have a minimum size as well as a maximum size. And the frame is resizeable of course. Ok, so now I've created the controls and added the size-hints using SetSizeHints. On wx.GTK it works fine, but on wx.MSW the maximum size is ignored completely. The sample code below shows the way I was trying it.

What am I doing wrong here ?

Thanks for your help,

Johannes

minmax.py (1.25 KB)

Bytewise wrote:

Hello,

I'm trying to create a frame with multiple controls. The should have an initial size (which is given on creation of the controls). Additionally the controls should have a minimum size as well as a maximum size. And the frame is resizeable of course. Ok, so now I've created the controls and added the size-hints using SetSizeHints. On wx.GTK it works fine, but on wx.MSW the maximum size is ignored completely.

The sizers don't do any checking of the max size of widgets. If it is
doing it on wxGTK then there must be native support for max sizes.

       # If the SizeHints are Set before "SetSizerAndFit" the initial size of
       # txa (150, -1) will be ignored on wx.GTK.
       txa.SetSizeHints(50, -1, 300, -1)
       txb.SetSizeHints(30, -1, 200, -1)

       # Using SetMinSize/SetMaxSize does not work either
       # txa.SetMinSize((50, -1))
       # txa.SetMaxSize((300, -1))
       # txb.SetMinSize((30, -1))
       # txb.SetMaxSize((200, -1))

Just FYI, give the control a size when you create it sets the minsize in
addition to setting the size of the control. Also, SetSizeHints and
SetMinSize/SetMaxSize are aliases for each other.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!