[wxPython-users] Ensure that a dialog is fully drawn
Robin Dunn
robin at alldunn.com
Mon Dec 11 22:34:19 PST 2006
Torsten Bronger wrote:
> Hallöchen!
>
> I defined a simple subclass of wx.Dialog called "WaitDialog", which
> I'd like to use like this:
>
> wait_message = WaitDialog(_(u"I'm bootstrapping, please be patient") + u" …", _(u"Bootstrapping"))
> wait_message.Show()
> # Here
> wx.Sleep(5)
> wait_message.Destroy()
>
> However, the frame of wait_message can never be really seen (at
> least not on my GTK system) because it's not updated early enough.
> How can I be sure that the frame is fully drawn at the point marked
> with "Here"? Thank you!
The reason you don't see anything is because you are not allowing any
events to be delivered to the dialog before you destroy it, so it is not
receiving any paint events (or any others,) and so it is not displayed,
painted, etc. The way you allow events to be delivered is to either
return to from the current event handler and let the MainLoop continue
to run, or you call something that will run a temporary nested event
loop, such as dialog.ShowModal, wx.Yield, etc. See this wiki page for
more discussion of how to manage doing things that take a "long time"
and still keep the UI responsive:
http://wiki.wxpython.org/index.cgi/LongRunningTasks
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list