non-print output in tty in python?

安稳与你 提交于 2019-12-12 19:50:28

问题


I dont know how to properly term what i want.

I want to make a program that doesnt just print and scroll but still be a linux-CLI program.

Lets say i write a program that does 3 things: 1, its tails a logfile 2, it shows the time 3, it runs a continous ping.

And say i want the time to be displayed in lower right corner, i want the logtail to scroll in the upper 5 lines of the terminal, and i want the ping to scroll (separately) in the main body of the terminal.

So what i am asking, basicly, is: can i make a cli-program behave like a GUI-program where the clock for instance just updates without printing it again, and there are 2 seperate data streams from subprocesses that scroll independantly

Did that make sense? Im pretty new to programming.


回答1:


You can control the Unix terminal more fully with the curses library. The library essentially lets you build a simple terminal GUI.

If you need more, take a look at Urwid as well. Urwid offers more complex GUI widgets for the discerning terminal GUI developer. :-)



来源:https://stackoverflow.com/questions/12603188/non-print-output-in-tty-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!