For multiple line printing, each console window on Windows is a number of lines, with number of columns... usually 25 lines and 80 columns as an old standard.
You can move a cursor to an (y, x) position, and print a string on screen.
y = line
x = column
Example code:
import ctypes
from ctypes import c_long, c_wchar_p, c_ulong, c_void_p
handle = ctypes.windll.kernel32.GetStdHandle(c_long(-11))
def move_console_cursor(y, x):
value = (x + (y << 16))
ctypes.windll.kernel32.SetConsoleCursorPosition(handle, c_ulong(value))
def print_string_at_cursor(string):
ctypes.windll.kernel32.WriteConsoleW (handle, c_wchar_p(string), c_ulong(len(string)), c_void_p(), None)
You then can print multiple lines over eachother by moving the cursor to the appropriate position and then print a string with the functions given.
A 3 line example: Easy would be to do a os.system('CLS')
to clear the screen, and then you can move cursor to 1,1
2,1
3,1
and repeat until you have done all your processing. At the end, don't forget to move your cursor to 4,1
. You can of course pick any location of your console window.