Underlying window contents showing in frame while loading

Larry Bates larry.bates at websafe.com
Sat Oct 13 12:02:32 PDT 2007


Larry Bates wrote:
> I have a frame that has a tree control, text ctrl and two buttons (ok, 
> cancel).  On the tree control I'm using virtual mixin that builds the 
> tree from a folder structure on WebDAV server.  First implementation 
> built the entire form before showing anything.  Depending on Internet 
> connection it can take 10-20 seconds.
> I wanted to show the form and THEN populate the tree.  I replaced the 
> overloaded OnGetChildreCount and OnGetItemText methods with dummy 
> methods and the form now loads much more quickly.  After .Show() I then 
> called method on tree control that set OnGetChildCount and OnGetItemText 
> to the real methods and called self.RefreshItems().  This populates the 
> tree as I would like with one problem.  The text control and the buttons 
> haven't been drawn on the form yet and information from the window that 
> is behind my frame shows through until the RefreshItems() method 
> returns, then they paint properly.  Is there some way to make sure that 
> .Show() is completely done drawing form's contents?  Everything works, 
> but the "garbage" that shows through is disconcerting.
> 
> Since this is difficult to explain, I've attached two window screenshots 
> showing what I'm talking about.
> 
> Thanks in advance for your help.
> 
> Larry Bates
> 
> 
While I know it's bad form to answer myself the answer was that I had to follow 
the call to self.Show() with self.Update().  Not entirely sure why .Show() 
doesn't complete fully before returning but this fixes the "issue".

-Larry





More information about the wxpython-users mailing list