loading message thingy

Tim Williams listserver at tdw.net
Wed Aug 11 11:45:50 CEST 2004

"Robbie" <user at domain.invalid> wrote in message
news:cfcndl$28em$1 at otis.netspace.net.au...

> Basically all I want to do is continuously write to the same line.
> So I could have a little rotating text thing showing that the script is
> working or display data ie, kb downloaded so far...
> ATM I am just calling a clear screen every pass with a little nap, nasty.

'\b' is a backspace, so.....

import sys,time

chars = ['|', '\\', '-', '/']
out = sys.stdout

def raw_print(txt):
    out.write("\b" + txt)

while 1:
    for x in range(len(chars)):

Save as a script and run it from your command prompt.

>Also it would be nice to be able to change more than one line so I could
>have 4 threads open downloading something with 4 lines each stating the
>current status of each thread

The code above should be able to handle this too with a small amount of
modding ,   I'd use a simple queue to get the information back from the
threads in an ordered and safe manner


More information about the Python-list mailing list