It looks like you're new here. If you want to get involved, click one of these buttons!
I am using RelativeProgress with the following pattern:
try:
progress = pya.RelativeProgress("Exporting...", len(list))
for item in list:
do_some_work(item)
progress.inc()
except:
self. handleError(sys.exc_info())
finally:
progress.destroy()
The progress bar is displayed, but it looks like this: I get two bars, with some flickering on the lower one:
How can I get rid of the second progress bar?
A second problem I have is, that the layout view panel stays "locked" with the progress bar, even after calling destroy().
Thanks a lot in advance.
Comments
Hi,
The second progress bar indicates an inner operation which also takes a progress. I assume that's something happening inside "do_some_work".
If the progress gets stuck this means there still is a progress bar object alive. This can happen for example, if you stop your script using the debugger. Or if your work function displays a modal dialog - in this case, an inner event loop is created and the outer event loop won't continue, hence not executing "progress.destroy()".
As you don't give me enough details to analyze the problem, I'm going to counter with a sample code which does NOT demonstrate the problem:
This code works nicely by writing the same file in a loop. It shows the duplicate progress: the upper one for the "Exporting ..." loop, the lower one for writing each file. When you push Cancel, the progress is nicely destroyed in the "finally" clause and the main window gets unlocked.
Matthias
Indeed, my do_some_work() includes a clip() operation which creates the 2nd progress bar. So it works as designed.
Thank you very much,
Michael
Very good ...
Any idea why it got stuck?
Matthias