程序如何覆盖先前的输出行?

2024-04-26 01:10:30 发布

您现在位置:Python中文网/ 问答频道 /正文

诸如vimtopalsamixer之类的程序输出多行文本,并以某种方式操纵已经编写的文本行。你知道吗

我知道如何将\r字符写入stdout,它将光标返回到行的开头,允许覆盖当前行,但不覆盖之前的任何行。你知道吗

这些程序是怎么做的,以使这些更先进的用户界面与花哨的终端操作?在我的情况下,我正在寻找一个Python解决方案,但任何一般信息将不胜感激。你知道吗


Tags: 文本程序信息终端topstdout方式情况
1条回答
网友
1楼 · 发布于 2024-04-26 01:10:30

您需要查看pythoncurses库。你知道吗

The curses module provides an interface to the curses library, the de-facto standard for portable advanced terminal handling.

While curses is most widely used in the Unix environment, versions are available for DOS, OS/2, and possibly other systems as well. This extension module is designed to match the API of ncurses, an open-source curses library hosted on Linux and the BSD variants of Unix.

相关问题 更多 >