Freeze/Thaw logic on wxMSW
|Reported by:||Infinity77||Owned by:|
|Keywords:||Freeze, Thaw, TLW||Cc:|
in order to reduce flicker when adding a bunch of controls to a frame or TLW, the standard practice is to call:
frame.Freeze() Add_Lots_Of_Controls() frame.Thaw()
However, if for some reason the creation of the controls is slow (many tabs in a notebook, a panel with many complex widgets on it and so on), the controls end up being seen even though the parent is frozen. Usually you can see a small blinking square/rectangle in the top-left area of a frozen TLW while the widgets are created.
The general consensus on the wxPython mailing list is that, between the call to Freeze and the call to Thaw no drawing, no painting, no visible layouting, no glitches, no nothing should be visible in the client area of the window for which Freeze and Thaw have been invoked. It looks like nothing special is being done for new windows that are created with frozen parents.
One way to work around that is to create the new windows hidden, which I think is able to be done using 2-phase create like this:
p = wx.PrePanel() p.Hide() p.Create(parent, ...)
Then do p.Show() later when you are ready to thaw everything.
I agree though that it would make sense that a new widget created with a frozen parent should start out in a frozen state.
I am not sure if this applies to wxMSW only, please someone correct my tags if this is not so.