Showing Progress Bar

Chris Angelico rosuav at gmail.com
Sat Nov 23 08:03:51 EST 2013


On Sat, Nov 23, 2013 at 11:11 PM, Frank Millman <frank at chagford.com> wrote:
> class ProgressBar(threading.Thread):
>     """
>     In a separate thread, print dots to the screen until terminated.
>     """

It's worth noting that this, as coded, is not a progress bar but
merely an activity bar. The number of dots printed depends on the time
taken and not on the amount of "stuff" done. For a true progress bar,
you'd have to manage something through the copy process itself -
figure out how much there is to copy, figure out how many dots to
display in total (probably a fixed number, eg 50), then output a dot
every X bytes or files copied, based on that proportion. This is a lot
simpler, of course!

ChrisA



More information about the Python-list mailing list