python tty中非打印输出? [英] non-print output in tty in python?

查看:98
本文介绍了python tty中非打印输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何正确地表达我的要求。

I dont know how to properly term what i want.

我想制作一个不仅可以打印和滚动但仍然是linux-CLI程序的程序。

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

让我说我编写了一个程序,该程序执行三件事:
1,其尾部为日志文件
2,它显示时间
3,它会连续执行ping操作。

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.

说我希望时间显示在右下角,我希望对角线在终端的上5行中滚动,并且我要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.

所以,我要问的基本上是:我可以使cli程序像GUI程序一样工作,例如,时钟只是更新而无需再次打印,子流程有2个独立的数据流,分别独立滚动

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.

推荐答案

您可以使用 curses 。该库实际上使您可以构建一个简单的终端GUI。

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

如果需要更多功能,请查看 Urwid 也是如此。 Urwid为挑剔的终端GUI开发人员提供了更复杂的GUI小部件。 :-)

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

这篇关于python tty中非打印输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆