On 21/09/12 19:32:20, Ian Kelly wrote:
Yes, the coordinates are 1-base, so it should have been
"\x1b[2J\x1b[1;1H". Or, since 1;1 is the default, "\x1b[2J\x1b[H".
On my machine, clear(1) uses "\x1b[H\x1b[2J".
Using clear(1) appears to be the most portable way to do it:
import os, time
data = """\
x....x
.x..x.
..xx..
..xx..
.x..x.
x....x
""".splitlines()
data = [line * 12 for line in data] # optional
try:
while True:
os.system("clear") # optional
for i, line in enumerate(data):
print line
data[i] = line[1:] + line[:1]
time.sleep(.1)
except KeyboardInterrupt:
pass
Hope this helps,
-- HansM