How to force a pop-up window to draw completely

I have a pop-up window (a new frame with some text) that is created by
a button click on my main GUI. Immediately after creating this pop-up
window my Python code calls an object which connects to another
computer via a socket and waits for a reply, ie, the code is in a
sleep state. I would like the pop-up window to draw completely before
this code gets executed because right now all I see is a partially
drawn window.

In my code for the pop-up I've tried both Refresh() and calling
wx.GetApp().ProcessPendingEvents() but neither has any effect in this
case.

I'm open to suggestions. Thanks!

Ron
oneelkruns@hotmail.com

rtk wrote:

I have a pop-up window (a new frame with some text) that is created by
a button click on my main GUI. Immediately after creating this pop-up
window my Python code calls an object which connects to another
computer via a socket and waits for a reply, ie, the code is in a
sleep state. I would like the pop-up window to draw completely before
this code gets executed because right now all I see is a partially
drawn window.

In my code for the pop-up I've tried both Refresh() and calling
wx.GetApp().ProcessPendingEvents() but neither has any effect in this
case.

I'm open to suggestions.

ProcessPendingEvents only takes care of wx events that have been added to the pending queue, it does not process pending system events. You'll need to call one of the yield functions for that. Update can be used to cause an immediate paint event to be processed for any dirty areas of the window, however if your frame contains other widgets I think you'll need to call Update on all of them. The best thing IMO is to not do anything in the GUI thread that blocks long enough for the user to notice.

http://wiki.wxpython.org/LongRunningTasks
http://wiki.wxpython.org/Non-Blocking_Gui

···

--
Robin Dunn
Software Craftsman

Robin Dunn wrote:

ProcessPendingEvents only takes care of wx events that have been added
to the pending queue, it does not process pending system events. You’ll
need to call one of the yield functions for that. Update can be used to
cause an immediate paint event to be processed for any dirty areas of
the window, however if your frame contains other widgets I think you’ll
need to call Update on all of them. The best thing IMO is to not do
anything in the GUI thread that blocks long enough for the user to notice.

LongRunningTasks - wxPyWiki
Non-Blocking Gui - wxPyWiki

Ok, this is good. I was hoping there was a way to simply force the GUI to get to a state where all events, drawing, etc has been done but using a thread for the task is not a problem, either.

Thanks

Ron

···

Bing™ brings you maps, menus, and reviews organized in one place. Try it now.