views:

48

answers:

2

I am essentially building a timer. I have a python script that monitors for an event and then prints out the seconds that have elapsed since that event.

Instead of an ugly stream of numbers printed to the command line, I would like to display only the current elapsed time "in-place"-- so that only one number is visible at any given time.

Is there a simple way to do this?

If possible I'd like to use built-in python modules. I'm on Windows, so simpler the better. (E.g. no X11).

+3  A: 

I use this: http://newcenturycomputers.net/projects/wconio.html

Ishpeck
+2  A: 

Outputting \b will move the output cursor left 1 cell, and outputting \r will return it to column 0. Make sure to flush the output often though.

Ignacio Vazquez-Abrams
I use sys.stdout.write('\r') in a loop! Thanks.
AndyL