Percent indication in place
Oleg Broytmann
phd at sun.med.ru
Fri May 7 04:04:43 EDT 1999
Hi!
For DOS/UNIX comsoles I wrote ttyProgressBar:
http://sun.med.ru/~phd/Software/Python/misc.html
Download pbar.tgz.
On Thu, 6 May 1999, Andrew M. Kuchling wrote:
> colmconn at my-dejanews.com writes:
> >How can I display a percentage-done indication that updates itself in place,
> >or show a "twirling baton" progress indicator?
>
> On a Unix terminal (and probably on an MS-DOS console), you
> can just print chr(8) to backspace, so a twirling display would look
> something like this:
>
> import time, sys
> sys.stdout.write(' ')
>
> for i in '|/-\|':
> sys.stdout.write( chr(8)+i ) ; sys.stdout.flush() ; time.sleep(1)
> print
>
> You have to flush standard output after each character so it gets
> immediately printed; otherwise they'll be buffered up, and the user
> won't see them.
>
> --
> A.M. Kuchling http://starship.python.net/crew/amk/
> You didn't join the rebellion, not because you felt I was wrong, but because
> you were too damned scared. What would you have done, had I won? Told me that
> you'd always supported me ideologically? That you were secretly cheering me on
> the whole time?
> -- Lucifer berates Remiel, in SANDMAN #60: "The Kindly Ones:4"
Oleg.
----
Oleg Broytmann National Research Surgery Centre phd2 at email.com
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-list
mailing list