how to accomplish dl progress bars?
Edvard Majakari
edvard+news at majakari.net
Fri May 27 04:08:34 EDT 2005
"flamesrock" <flamesrock at gmail.com> writes:
> Certain web applications, everything from wget to downloader for X has
> this nifty feature I'd like to accomplish in python.
>
> Its the progress bar/time elapsed/time remaining scheme
>
> Filename | Progress | Speed (kB/s) | T/Elapsed | T/Remaining
> ----------------------------------------------------------------------------
> blah.bin |------>45% | 56.6 | 02:39 | 02:45
> file2.bz2 |--->33% | 35.0 | 05:22 | 11:24
> etc |-------->60% | 47.5 | 00:14 | 00:08
See python cookbook. The idea is simply to print out stuff and when updating,
erase previous characters eg. using '\r' ASCII code. Python Cookbook has a
progress bar implementation, you could use that as a basis for your code
(speed, t/elapsed and t/remaining are technically no different; if you can do
a progress bar, you can do those others as well).
--
# Edvard Majakari Software Engineer
# PGP PUBLIC KEY available Soli Deo Gloria!
$_ = '456476617264204d616a616b6172692c20612043687269737469616e20'; print
join('',map{chr hex}(split/(\w{2})/)),uc substr(crypt(60281449,'es'),2,4),"\n";
More information about the Python-list
mailing list