wxPython before MainLoop

david david at nospam.spam
Tue Aug 21 03:58:40 EDT 2007


 > Looking at the Chandler code suggests a solution
 > ... he may need to call Update to finish painting
 > the display.


Yes, and thank you to Chandler for pointing that out.

Without the splash screen there was no need to call
Yield or use a generator.

(david)

samwyse wrote:
> Chris Mellon wrote:
>> On 8/9/07, Heikki Toivonen <heikki at osafoundation.org> wrote:
>>
>>> [david] wrote:
>>>
>>>> I'd like to refresh the display before I start the main loop.
> 
> If your window isn't able to interact with the user, then I'd consider 
> it a splash screen, no matter if it does look exactly like your main 
> application interface.
> 
>>> We have this kind of situation in Chandler, where we display and update
>>> the splash screen before we enter MainLoop.
>>>
> [...]
>>> 3. The splash screen refresh is basically: draw new stuff,
>>> self.Layout(), self.Update(), wx.Yield()
>>> http://lxr.osafoundation.org/source/chandler/application/Application.py#1421 
>>>
> 
> Looking at the Chandler code suggests a solution to [david]'s original 
> problem.  It is possible that, on Windows only, he may need to call 
> Update to finish painting the display.
> 
> 1432         self.Layout()
> 1433         if wx.Platform == '__WXMSW__':
> 1434             self.Update()
> 1435         wx.GetApp().Yield(True)
> 
>> wxYield spins the event loop in place. This can have some serious
>> consequences if you aren't very careful with your usage, like
>> recursively entering event handlers. I generally consider it an
>> experts only interface, and avoid it.
> 
> I'll confess to being one of those old-school programmers who, back in 
> the day, wrote his code around big select loops instead of using 
> threads, but I'm intriged by the "experts only" designation.  Can 
> someone explain further?  Thanks!



More information about the Python-list mailing list