PyProgressDialog...

Hello NG,

I have managed to create a PyProgressDialog from wxProgressDialog C++ generic implementation. This could possibly be useful for me to create sme kind of “general waiting dialog” that does not require a maximum value, with something like a gauge that runs from left to right and right to left. This kind of dialog is useful if you don’t know how much time (or how many iterations) an operation will require, and you want to keep the user informed that something is going on. You may object that I could use a wx.ProgressDialog with a very high maximum value, but it’s really ugly to see the gauge that does not progress for long time.

Well, the widget sems to work as expected, but there is a problem. By running the wxPython demo (you can find it at the end of the mail) I noticed that the dialog is perfectly responding, the mouse pointer is NOT in the busy state and the Cancel button responds quickly. If I try the same with my custom class, the mouse pointer changes to busy state and the cancel button does not respond until the gauge has finished. It is probably due to the while loop in the sample code, but I am wondering: how can the C++ implementation be so responsive even if it is inside the while loop? Why in Python I get the mouse in the busy state?

Thank you for all hints.

Andrea.

max = 80

dlg = wx.ProgressDialog(“Progress dialog example”,
“An informative message”,
maximum = max,
parent=self,
style = wx.PD_CAN_ABORT
> wx.PD_APP_MODAL
> wx.PD_ELAPSED_TIME
> wx.PD_REMAINING_TIME
)

keepGoing = True
count = 0

while keepGoing and count < max:
count += 1
wx.MilliSleep(250)

if count >= max / 2:
keepGoing = dlg.Update(count, “Half-time!”)
else:
keepGoing = dlg.Update(count)

dlg.Destroy()

···


“Imagination Is The Only Weapon In The War Against Reality.”

http://xoomer.virgilio.it/infinity77/

Saturday, May 6, 2006, 8:01:36 PM, Andrea Gavana wrote:

(...) I am wondering: how can the C++ implementation be so
responsive even if it is inside the while loop?

I don't know how the C++ version was implemented, but maybe calling
wx.Yield() inside the while loop may help.

-- tacao

No bits were harmed during the making of this e-mail.