loading message thingy

Eddie Corns eddie at holyrood.ed.ac.uk
Wed Aug 11 12:20:17 EDT 2004


Robbie <user at domain.invalid> writes:

>Even though this is not very important it would be nice to get working.

>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.

>Something along these lines:
>for i in range(1000):
>      print "Loading... %s" % file_size
>      os.system("clear")
>      sleep(0.5)
>I also tried something with \r but that never quite worked...
>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...
>		
In the old days we all used to know all the ANSI control sequences off by
heart.  Nowadays you have it easy with curses and the like.  Not sure if
curses can be used to just use as many lines as you need rather than the whole
screen.  Perhaps it's over the top but you 0nly need to do it once.

The \r trick is the most common though, maybe you should try to get that
working.  Then squeeze all statuses onto 1 line eg:

File 1       File 2      File 3     File 4
  23%          45%        100%         0%\r  24%     etc.

Eddie



More information about the Python-list mailing list