screen output problem

Ritesh Raj Sarraf rrs at researchut.com
Sat Nov 25 18:27:26 EST 2006


Hi,

I have, for very long, been trying to find a consistent solution (which
could work across major python platforms - Linux, Windows, Mac OS X)
for the following problem.

I have a function which downloads files from the web. I've made the
function threaded. I'm trying to implement a progress bar for it which
could work across all the platforms.

The problem is that when the progress bar is displayed, all the threads
overwrite the progress bar.

I've thought of using curses but AFAIK curses is not available for
Windows.

Is there a generic way to accomplish the following:

progress = "[===================]\n[=======================]"
for x in range(5):
    sys.stdout.write(progress + "\r")

Basically, I want a way through which I want to display data on two
lines and make sure that "\r" overwrites the two lines without putting
a newline making sure that whatever library it uses is available across
all major Python platforms.

Thanks,
Ritesh




More information about the Python-list mailing list