cursor positioning

James Carroll mrmaple at gmail.com
Mon Jul 11 10:55:00 EDT 2005


I haven't tried this myself, but I think the secret to displaying a
continuously updating %done on the command line is to
    print "file 100, 1% done"

then send exactly 7 backspaces to the terminal, then print 2% done...
so the backspaces will write over the previous text.

Backspace is a \x08 (ascii character with the value 8.)

It _could_ work...

-Jim


On 7/11/05, Albert Leibbrandt <albert at compuscan.co.za> wrote:
> -----Original Message-----
> From: python-list-bounces+albert=compuscan.co.za at python.org
> [mailto:python-list-bounces+albert=compuscan.co.za at python.org] On Behalf Of
> Mage
> Sent: 11 July 2005 04:28 PM
> To: python-list at python.org
> Subject: Re: cursor positioning
> 
> Larry Bates wrote:
> 
> >While not "curses" based this class will update screen as you
> >want.  You could use it as a basis upon which to do a curses
> >version with your cursor positioning.
> >
> >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299207
> >
> >
> >
> Thank you. This is good for displaying the percentage.
> However it fails to display this:
> 100 files read
> 200 files read
> 300 files read
> ....
> 
> of course all in the same line and not under the last line.
> 
>        Mage
> 
> 
> --
> Why not use something like this?
> 
> counter = 0
> 
> while 1:
>     if (counter % 100) == 0:
>         print'%s files read '%counter
>     counter += 1
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
> 
>



More information about the Python-list mailing list