I'd like to have both:
Lines displayed each one after another (Blah 12, Blah 13, Blah 14, etc.) like in a normal terminal
Fixed position information (on right) : Date + fixed text "Bonjour"
It nearly works, until ~ Blah 250, when the look is destroyed! Why?
(source: gget.it)
from sys import stdout
import time
ESC = "\x1b"
CSI = ESC+"["
def movePos(row, col):
stdout.write("%s%d;%dH" % (CSI, row, col))
stdout.write("%s2J" % CSI) # CLEAR SCREEN
for i in range(1,1000):
movePos(i+1,60)
print time.strftime('%H:%M:%S', time.gmtime())
movePos(i+5,60)
print 'Bonjour'
movePos(24+i,0)
print "Blah %i" % i
time.sleep(0.01)
With an ANSI terminal, how to have both normal terminal behaviour (one new line for each print
) + fixed position display?
Note: On Windows, I use ansicon.exe to have ANSI support in Windows cmd.exe.