views:

12

answers:

0

I have a frame that contains (among many other things) a panel. I need to be able to explicitly set the size of the panel and have the frame with all its sizers, buttons, and everything else fit around the new size of the panel. I have tried every combination of Fit/Layout/etc I can think of, but I can never get the frame to grow/shrink to accomodate the new size of the panel. Here are the relevant portions of my code:

class MyFrame(wx.Frame): 
    def __init__(self):
        wx.Frame.__init__(self, None, -1, style=wx.DEFAULT_FRAME_STYLE)
        self.window = wx.Panel(self, size=(400,300), style=wx.BORDER_SIMPLE)

        ...create some other widgets and add them to sizers...

        winSizer = wx.BoxSizer(wx.HORIZONTAL)
        winSizer.Add(self.window, 1, wx.EXPAND|wx.ALL, SPACE)

        self.sizer = wx.BoxSizer(wx.VERTICAL)

        ...add the other widgets/sizers to self.sizer...

        self.sizer.Add(winSizer, 1, wx.EXPAND|wx.ALL, SPACE)
        self.SetSizerAndFit(self.sizer)

        self.SetMinSize(wx.Size(400,500))
        self.SetMaxSize(wx.Size(760,790))
        self.window.SetMinSize(wx.Size(MIN_WIDTH, MIN_HEIGHT))

    def SetWindowSize(self, _event):

        ...get the new width and height I want...
        self.window.SetSize(wx.Size(w,h))
        ...THIS IS WHERE I NEED HELP!!!!!...

After I set the size of self.window, what the heck do I do to get the frame to grow/shrink accordingly? Thank you!