loading message thingy
listserver at tdw.net
Wed Aug 11 15:01:26 CEST 2004
----- Original Message -----
From: "Tim Williams" <listserver at tdw.net>
> "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,
> '\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)):
Thinking about it, '\b' can cancel out the extra space at the end of a
"print char," (with the comma on the end)
so, this does the same thing ....
chars = ['|', '\\', '-', '/']
for x in range(len(chars)):
print "\b\b" + chars[x],
More information about the Python-list