[Tutor] writing over text

Alan Gauld alan.gauld at btinternet.com
Tue Jul 10 22:13:14 CEST 2007


"max ." <dos.fool at gmail.com> wrote

> hello i am writing a population script and was wondering  if i can 
> just keep
> writing to the same line instead of printing a new line every second

Depending on the terminal type you can use control codes to
move the cursor. Thus on most Unix terminals you can use Ctrl-U
to delete the line, thus if you wriote a Ctrl-U character before each
line and suppress the newline at the end it will appear that all
output is on a single line.

On a DOS ANSI terminal I can't recall the Ctrl code used, but it
is possible.

Another option is to use the curses module which allows you
to specify the screen coordinates where you write. A similar
module is available for DOS on the web - I think I saw it on
the vaults of Parnassus.

HTH,

Alan G. 




More information about the Tutor mailing list