This is a general concurrency problem. Your application is not
multithreaded, and it is blocking execution of everything else while
it is running (you won't be able to interact with your application,
either).
There are a number of ways to work around this. The most common is to
run your worker function from a secondary thread, having it post an
event back to the main thread (using wx.CallAfter) when it is
completed. In response to this "completed" thread, your application
can destroy the progress dialog and continue processing.
Recent version of wxPython include a library called
wx.lib.delayedresult which can help with this, it is featured in the
demo under the process and events category.
···
On 1/3/07, Rooney, Mike (ext. 324) <mxr@qvii.com> wrote:
Hello everyone. I am looking for a progress dialog that basically just moves along and starts over again until it is told to stop or destroy. I have seen these in Windows and other places all the time however not in wx. Normally I hate progress dialogs that don't actually show progress, however for our current application a call is made to a module that could take awhile and we have no way of getting actual progress, but I want the user to know the program hasn't frozen.
I have tried using a wxTimer which calls Pulse() on the ProgressDialog every 100 milliseconds, however that didn't do anything while the function call was running, defeating the entire purpose. I also tried making a little class that Pulses the dialog and running that in a thread, which also didn't work. Maybe the function call is taking up all the CPU and that is why the timer and thread didn't work? I once had the function call crash and then the dialog pulsed along as I would expect, so that seems to tell me what I am doing is right but it isn't getting enough priority. This is why I thought if there was a built-in way to do this in wx it might solve the problem.
Does anyone have any ideas as to how to solve this issue?