Swapping a panel dynamically in a static box

Does something like this helps?
        self.parent_sizer.SetItemMinSize(self.panelParameters,
self.panelParameters.GetSize())
        self.FitInside()

I would also recommend to place these operations between self.Freeze()
and self.Thaw() to avoid flickering.

Stani

···

On 1/12/06, Marco Aschwanden <PPNTWIMBXFFC@spammotel.com> wrote:

Hi

Depending on the chosen report I would like to show a panel with
appropiate settings. This is what I am doing:

parent_sizer = self.panelParameters.GetContainingSizer()
parent_sizer.Detach(self.panelParameters)
self.panelParameters.Destroy()
self.panelParameters = demo_panel.PanelReportParams(self.mainPanel, -1)
parent_sizer.Insert(0, self.panelParameters, 1, wx.EXPAND, 0)
self.Layout()

The new panel is shown on the upper left corner of the Frame (instead
within the static box). If I do a resize by hand - it will be perfectly
placed afterwards and the static box has as well adapted its size to fit
the new parameter panel.

So I could do:

(width,heigth) = self.GetSizeTuple()
self.SetSize((width+1,heigth+1))
self.SetSize((width,heigth))

But this is a bad hack! How to do it right?

I tried Refresh() --> The new panel remains in the upper left corner of
the frame.
I tried Fit() --> does the job but resizes my window to its minimum.
I tried parent_sizer.Layout() in addition to self.Layout() --> the panel
was now shown within the static box but it was not resized to fit

Thanks for any hint in advance!

Regards,
Marco

--

http://pythonide.stani.be/screenshots
http://pythonide.stani.be/manual/html/manual.html