Sizer keep minimal window size?

Hello,

First thanks all, who have answered my previous questions.
Now I've in trouble with Sizers.
I've a wxFrame and on this Frame a wxPanel. On the Panel I've created
several controls with wxBoxSizer.
All works fine, but I want to keep a minimal wxFrame size. (The
user cannot change the Frame's size smaller than this limit.)

How can I do this?

Thanks
  Attila

(I've probed to catch OnSize event of the Frame, and resize to minimal
size but didn't happened what I want.)

This is the incantation that I often use:

        self.SetSizer(self.sizer)
        self.SetAutoLayout(1)
        self.sizer.Fit(self)
        self.sizer.SetSizeHints(self)

Try the following example and see what happens when you comment out
the sizer.Fit(self) and sizer.SetSizeHints(self) lines on both the
panel and the frame.

#!/usr/bin/env python
from wxPython.wx import *

class MyPanel(wxPanel):
    def __init__(self, parent):
        # create panel
        wxPanel.__init__(self, parent, id=-1)
        # create the controls
        text1 = wxStaticText(self, -1, "Choose your category")
        choice1 = wxChoice(self, 40, choices = [])
        choice1.Append("Any Category","Any")
        choice1.Append("Other Category","Other")
        choice1.SetSelection(0)
        list1 = wxListBox(self, 60, (-1,-1),
                          (-1,-1), [], wxLB_SINGLE)
        list1.Append("Test Data","Item 1")
        list1.Append("Test Data 2","Item 2")

        # create the sizers
        sizer1 = wxBoxSizer(wxVERTICAL)
        sizer2 = wxBoxSizer(wxHORIZONTAL)

        # add controls to sizers
        sizer2.Add(text1, 1, wxEXPAND)
        sizer2.Add(choice1, 1, wxEXPAND)
        sizer1.Add(sizer2, 0, wxEXPAND|wxALL, border=10)
        sizer1.Add(list1, 1, wxEXPAND|wxALL, border=10)

        # enable sizers
        self.SetSizer(sizer1)
        self.SetAutoLayout(1)
        sizer1.Fit(self)
        sizer1.SetSizeHints(self)

class MyFrame(wxFrame):
    def __init__(self):
        wxFrame.__init__(self, None, -1, 'Sizer Demo')
        panel1 = MyPanel(self)
        sizer = wxBoxSizer()
        sizer.Add(panel1, 1, wxEXPAND)
        self.SetSizer(sizer)
        self.SetAutoLayout(1)
        sizer.Fit(self)
        sizer.SetSizeHints(self)

class MyApp(wxApp):
    def OnInit(self):
        frame = MyFrame()
        frame.Show(1)
        return 1

app = MyApp(0)
app.MainLoop()

···

--- Sz�ts Attila <aszuts@lsc.hu> wrote:

Hello,

First thanks all, who have answered my previous questions.
Now I've in trouble with Sizers. I've a wxFrame and on this
Frame a wxPanel. On the Panel I've created several controls
with wxBoxSizer. All works fine, but I want to keep a minimal
wxFrame size. (The user cannot change the Frame's size smaller
than this limit.)

How can I do this?

=====
Donnal Walter
Arkansas Children's Hospital

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

you can use

Frame.Fit()
size = Frame.getSizeTuple()
Frame.SetSizeHints(size[0],size[1])

or something like that. This sets the minimum size, which I think is
what you wanted. YOu can also set the max size, or boith (to keep it one
size). See the wxWindows Docs for details

-Chris

···

--- Szüts Attila <aszuts@lsc.hu> wrote:
> I want to keep a minimal
> wxFrame size. (The user cannot change the Frame's size smaller
> than this limit.)
>
> How can I do this?

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov