问题
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