wx.ProgressDialog events wxPython 2.9

Hi,
I have an application which uses wx.ProgressDialog . The code is similar to the attached example. When user clicks “progress” button task thread starts and progress dialog should be updated. In wx 2.8.10.1 it works correctly:

  • the application when starts, progress dialog is hidden
  • worker thread sends notifications to the progress dialog
  • progress dialog receives these notifications and updates displayed message and progress
    On wx Python 2.9.2.1 however progress dialog doesn’t hide at the beginning and what is more important notifications are not received by the progress dialog.

Is this an error in wx 2.9 or I am doing something wrong here?

regards,

Krzysztof

wxapp5.py (2.23 KB)

I'm not sure why the hide is not working. Which platform? But in either case I've always seen the progress dialog created just when needed. Is there some reason you think you need to keep it around?

The main problem is that you are blocking in __onProgress instead of returning to the event loop, so events are not able to be delivered. If it worked in 2.8 then there is probably a yield happening in the wx code someplace, or in some other part of your code.

Instead of blocking in __onProgress you can just let it return and then update the progress dialog (or close it when done) in __update.

···

On 8/16/11 8:10 AM, uhz wrote:

Hi,
I have an application which uses wx.ProgressDialog . The code is similar
to the attached example. When user clicks "progress" button task thread
starts and progress dialog should be updated. In wx 2.8.10.1 it works
correctly:

  * the application when starts, progress dialog is hidden
  * worker thread sends notifications to the progress dialog
  * progress dialog receives these notifications and updates displayed
    message and progress

On wx Python 2.9.2.1 however progress dialog doesn't hide at the
beginning and what is more important notifications are not received by
the progress dialog.

Is this an error in wx 2.9 or I am doing something wrong here?

--
Robin Dunn
Software Craftsman

I’m running on Windows Vista. Possibly I don’t need to keep the progress dialog around, there is no explicit yield in my code (see the example).

But it turns out that adding yield near wx.MilliSleep solves my issue. Thanks for the hint :slight_smile:

regards,
Krzysztof

Platform - windows Vista.

I have a long running task during which I show the progress dialog - a kind of long import. Additionally I have to ask user for some decisions from time to time - I would like to show a modal window on top of the progress dialog with a question to the user. Unfortunatelly it seems impossible in wx 2.9. I cannot do anything with the progress dialog - cannot deactivate it, hide or even force my question window to be on top. I don’t want to destroy the progress dialog because the time left would reset. Do you have any idea of how I could do this with progressdialog from wx 2.9?

In 2.9 a new native dialog is being used for the wx.ProgressDialog on new enough Windows systems, I expect that it is the problem. You can get the old non-native progress dialog class by using wx.GenericProgressDialog instead.

···

On 10/13/11 7:48 AM, uhz wrote:

Platform - windows Vista.

I have a long running task during which I show the progress dialog - a
kind of long import. Additionally I have to ask user for some decisions
from time to time - I would like to show a modal window on top of the
progress dialog with a question to the user. Unfortunatelly it seems
impossible in wx 2.9. I cannot do anything with the progress dialog -
cannot deactivate it, hide or even force my question window to be on
top. I don't want to destroy the progress dialog because the time left
would reset. Do you have any idea of how I could do this with
progressdialog from wx 2.9?

--
Robin Dunn
Software Craftsman

But it is not available in wx 2.9.2.4?

Oops, sorry. I forgot that I added that after the release, I thought it was before.

···

On 10/14/11 1:58 AM, uhz wrote:

But it is not available in wx 2.9.2.4?

--
Robin Dunn
Software Craftsman

W dniu 2011-10-14 18:42, Robin Dunn pisze:

···

On 10/14/11 1:58 AM, uhz wrote:

But it is not available in wx 2.9.2.4?

Oops, sorry. I forgot that I added that after the release, I thought it was before.

Is the next release scheduled? One that will include GenericProgressDialog?

Regards,
     Adam Bielański.

Nothing definite yet, things are still in a "whenever it's ready" stage.

Meanwhile there is wx.lib.agw.pyprogress or it shouldn't be too hard to make your own using the generic C++ code as inspiration.

http://trac.wxwidgets.org/browser/wxWidgets/trunk/include/wx/generic/progdlgg.h
http://trac.wxwidgets.org/browser/wxWidgets/trunk/src/generic/progdlgg.cpp

···

On 10/17/11 12:42 AM, Adam Bielański wrote:

W dniu 2011-10-14 18:42, Robin Dunn pisze:

On 10/14/11 1:58 AM, uhz wrote:

But it is not available in wx 2.9.2.4?

Oops, sorry. I forgot that I added that after the release, I thought
it was before.

Is the next release scheduled? One that will include GenericProgressDialog?

--
Robin Dunn
Software Craftsman