Little known ETS features: Progress Dialog

ETS contains a lot of nice features which don’t get any press, many of which aren’t event well known in the Enthought office. Today I thought I’d show off the ProgressDialog class I wrote more than a year ago.

The ProgressDialog class is intended to have an API similar to QT and Java’s progress dialogs has many of the same features:

  • Optionally show estimated time remaining
  • Supports indeterminate progress where the total number of steps is not known
  • Cancel and skip buttons
  • Automatically closes for determinate instances

This is all the code needed to do a dialog while doing a simple loop (the entire example can be found here):

[sourcecode language=python]
def task_func(t):
progress = ProgressDialog(title=”progress”, message=”counting to %d”%t,
max=t, show_time=True, can_cancel=True)

for i in range(0,t+1):
print i
(cont, skip) = progress.update(i)
if not cont or skip:


Here’s what the progress dialog looks like using the WX backend (yes, there is a QT4 backend too)

ProgressDialog Screenshot

5 thoughts on “Little known ETS features: Progress Dialog

  1. avatarJed

    That is very nice. One quick question though. What is the rational for the using progress.update(t) on line 13 of your snippet? It seems like it would be clearer to use progress.close() to match the earlier

  2. avatarbryce

    Gabriel, it could be refactored pretty easily, as long as you only want the WX or QT4 version. Traits is only used to declare attributes with default values. Have a look at the source for the WX version if you’re interested

  3. avatarbryce


    This example uses the auto-close feature, line 13 isn’t necessary at all, but is there as a safety precaution. What is nice about this approach is the progress bar will always reach 100% before closing.

    You can manually close the window as well, though you should check to ensure it is open before making the call to close it.

  4. avatarJonathan

    Nice, but I found a bug. In my version (Canopy 1.0.3 Pyface 4.3.0) it crashes at line 302 of The problem is wx.NullColor, which should be NullColour with a u.


Leave a Reply

Your email address will not be published. Required fields are marked *

Please leave these two fields as-is:

Protected by Invisible Defender. Showed 403 to 107,115 bad guys.