Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python console application - output above input line

I am trying to write a console application in Python3.

The problem is I would like all output messages EG: print("Status message") to be above the input line at the bottom.

Status message 1
Status message 2
Status message 3
Console:> I want to type here while the output messages displayed

at the moment it looks more like this

Console:>  want to type here while the outStatus message 1
put messages displayed

Is there anyway to do this without using curses?

like image 549
Sean Wilkinson Avatar asked Jan 13 '13 02:01

Sean Wilkinson


1 Answers

Try this:

print chr(27)+'[2AOutput'

Hope this is what you are asking for.

Sorry the above is for Python 2.7. I am not sure whether the Python 3 version

print(chr(27)+'[2AOutput')

will work or not.

Ref: http://en.wikipedia.org/wiki/ANSI_escape_code

like image 143
FJDU Avatar answered Nov 12 '22 05:11

FJDU