I couldn't find any module that would just let me add progress to all the random little scripts I write. So I wrote one. You can download and read about it at http://www.casualhacker.net/blog/progress_py/ Below is the module's description. I welcome any comments and suggestions.
DESCRIPTION This module provides 2 classes to simply add progress display to any application. Programs with more complex GUIs might still want to use it for the estimates of time remaining it provides.
Use the ProgressDisplay class if your work is done in a simple loop: from progress import * for i in ProgressDisplay(range(500)): do_work()
If do_work() doesn't send any output to stdout you can use the following, which will cause a single status line to be printed and updated: from progress import * for i in ProgressDisplay(range(500), display=SINGLE_LINE): do_work()
For more complex applications, you will probably need to manage a Progress object yourself: from progress import * progress = Progress(task_size) for part in task: do_work() progress.increment() progress.print_status_line()
If you have a more sophisticated GUI going on, you can still use Progress objects to give you a good estimate of time remaining: from progress import * progress = Progress(task_size) for part in task: do_work() progress.increment() update_gui(progress.percentage(), progress.time_remaining())