Doing this simple way
, , colorama, ANSI (.: http://en.m.wikipedia.org/wiki/ANSI_escape_code)
, , CUP - (CSI n; m H), n m.
:
def move (y, x):
print("\033[%d;%dH" % (y, x))
,
Windows, , - API .
, colorama () , colorama.init().
, colorama, .
import ctypes
from ctypes import c_long, c_wchar_p, c_ulong, c_void_p
gHandle = ctypes.windll.kernel32.GetStdHandle (c_long (-11))
def move (y, x):
"""Move cursor to position indicated by x and y."""
value = (x + (y << 16)
ctypes.windll.kernel32.SetConsoleCursorPosition (gHandle, c_ulong (value))
def addstr (string):
"""Write string"""
ctypes.windll.kernel32.WriteConsoleW (gHandle, c_wchar_p (string), c_ulong(len (string)), c_void_p (), None)
, - , , , , curses.
, API , - .
try:
import curses
HAVE_CURSES = True
except:
HAVE_CURSES = False
pass