Skip to content Skip to sidebar Skip to footer

Python Multiple Line Terminal Update

Short Question Is it possible/practical to write and update a multi-line (contains \n) string on a Windows terminal? Background I have looked into curses, but it is Unix only. I

Solution 1:

The closest thing I could find to curses (that has been updated in the last 10 years) was Windows Console Driver. Rather than use this approach I went at it was a less elegant method.

import os
import time

while(1):
    time.sleep(.05)
    os.system('cls')
    print "This is a multi-line screen print test"
    print "Line 1" 
    print "Line 2" 

Solution 2:

You might have to use the Windows Console API. For example, SetConsoleCursorPosition. Other people appear to have implemented Python modules to support this API: 1, 2


Post a Comment for "Python Multiple Line Terminal Update"