473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

how to accomplish dl progress bars?

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

(could be either text or a gui..)

So where would one begin to accomplish this sort of thing efficiently?

I've searched the web and there are plenty of resources on network
programming in python, but how could I
1) keep track of download speed
2) calculate t/elapsed/remaining
3) output that to a progress bar

w/o spawning countless threads to do the many calculations and avoid
eating up the entire CPU.

This seems like it would require a lot of resources and easily go out
of sync with the real world file transfer. To compound problems, I have
a very limited understanding of threads and using multiple threads that
rely on eachother doesn't make very much sense.

Can anyone point me in the right direction?

-thanks in advance

Jul 19 '05 #1
2 2030
"flamesrock" <fl********@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!

$_ = '456476617264204d616a616b6172692c20612043687269737 469616e20'; print
join('',map{chr hex}(split/(\w{2})/)),uc substr(crypt(60281449,'es'),2,4),"\n";
Jul 19 '05 #2
thanks! I didn't realize it was in the cookbook:

http://aspn.activestate.com/ASPN/Coo.../Recipe/168639

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Paul | last post by:
i have been working with vb6 for a while but never had the pleasure of using progress bars. That is until now, one of the programs i have written has just been modified so that large csv files of...
0
by: Tom Wesley | last post by:
Hi, I'm looking at switching my cdr backup script over to using python and pygtk, mainly as an exercise in learning python. I already have an iso file created by a cron job every night, and...
1
by: Doug Helm | last post by:
Hey, Folks: I'm writing a CGI to handle very large file uploads. I would like to include a progress bar. I think I'm about done. I have code to handle the file upload, and I think I can add...
0
by: Martin Platt | last post by:
Hi, I'm looking into various options for a fairly simple backup utility for our application. I have no problems being able to backup, find restorable backup files, and restore then. What I'd...
1
by: Xarky | last post by:
Hi, I am trying to use progress bars, where the progress is seen as vertical. I am succeding to manage progess bars, where progress is increasing horizontally, but not vertically. Can someone...
6
by: Kyle | last post by:
I want to do a single pix update bar instead of the big block that progress bars usually use. I can't seem to find any info on how to do this. Thanks in advance for any help, Kyle
0
by: Joel Cade | last post by:
I'd just like a sanity check on my thinking. I'm attempting to create a progress bar for a file upload to an ASPX page. I'm adding an HTTP Module, which would then call into a "Progress Handler",...
9
by: Scirious | last post by:
People, I want to do same things with a progress bar but I don't know how. So, how do I change it to make it a solid bar, not a step byt step as the default? And how do I make it a vertical bar?...
0
by: nate1299 | last post by:
I need help to Custumize progress bar from the defult windows 7 progress bars And i want to make aqua buttons like mac os x buttons
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.