[wxPython-users] dialog hangs when Sleep() called

Andrea Gavana andrea.gavana at gmail.com
Thu Jul 5 01:29:26 PDT 2007


Hi Holio,

On 7/5/07, Holio wrote:
> for x in xrange ( 25 ):
>   wx.Sleep ( 2 )
>   dialog.Update ( x + 1, 'On step ' + str ( x + 1 ) + '.' )
>
> It works well at first, but If I switch to another window and then
> switch back, progress dialog will have no reponse at most 2 secs. It
> may be because there are only one thread, and It can't interactive
> with user or draw when It's Sleeping, Is it? And how do I do to solve
> this? Thanks.
>
> P.S. Actually, dialog not only hangs when Sleep. I tried to do some
> time-waste work in between two dialog.Update, e.g. download file, and
> dialog gets hang, too.

If you have some process which requires a long time to run, I suggest
you to read this Wiki page:

http://wiki.wxpython.org/LongRunningTasks

It has helped me a lot ;-)

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/




More information about the wxpython-users mailing list