prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.37k stars 716 forks source link

Full-screen App with Terminal Characters #1258

Open Queuecumber opened 4 years ago

Queuecumber commented 4 years ago

I'm writing a full screen app that takes input from multiple files which are being written to by remote processes. These processes use tqdm to display progress bars (their output is redirected to the files). If I read the files using standard python and use the print function, the bars display fine. Now I want to display all the files at the same time so I'm using this library to make a split screen full screen app. The problem is the display looks like this:

Screenshot from 2020-09-28 20-15-22

with each update printed on a new line preceded by ^M

is there a way to display this properly?

Queuecumber commented 4 years ago

The actual character that it's using is \x1b[A "cursor up"

Queuecumber commented 4 years ago

I see that it's supported in some capacity here: https://github.com/prompt-toolkit/python-prompt-toolkit/pull/1080/files#diff-0a8bfa00afa04946b2b3c8faaa853e12L58 but I'm not sure how to translate that into what I'm doing. I currently am writing the strings to a TextArea using ANSI formatted text with the tricks from #711