== Introduction == I had trouble finding out how to resize a frame when controls were shown or hidden. This documents the results of my search of the mailing lists and experiments. == What Objects are Involved == wxPanel, wxSizer == Process Overview == The code displays a frame with a toggle button and a pane below it containing some controls. Toggling the button shows and hides the control pane, resizing the frame as appropriate. == Code Sample == The skeleton of this code is derived from the sample code at XrcStartingPoints. {{{ import wx from wx import xrc GUI_FILENAME = "t.xrc" GUI_MAINFRAME_NAME = "FRAME1" class MyApp( wx.App ): def OnInit( self ): self.res = xrc.XmlResource( GUI_FILENAME ) self.frame = self.res.LoadFrame( None, GUI_MAINFRAME_NAME ) self.frame.Show(1) self.showControls = xrc.XRCCTRL(self.frame, 'showControls') self.controlPanel = xrc.XRCCTRL(self.frame, 'controlPanel') self.Bind( wx.EVT_TOGGLEBUTTON, self.OnChange, self.showControls) return 1 def OnChange(self, event): sizer = self.frame.GetSizer() sizer.Show( self.controlPanel, show=self.showControls.GetValue(), recursive=True) size=sizer.GetMinSize() self.frame.SetMinSize(size) self.frame.Fit() if __name__ == '__main__': app = MyApp(0) app.MainLoop() }}} and t.xrc: {{{ Test 1 wxVERTICAL 1 wxHORIZONTAL }}} === Comments === I don't know if this is the best way to do this, but the code is clean and it works. Please add any comments.