如何让 Python curses overlay 不透明?

How to make Python curses overlay not transparent?

默认情况下,Python curses 叠加层是透明的,其中任何非字符 space 都会显示下面的 window。即使添加' '字符,它仍然显示下面的字符。

有没有办法让叠加层的 space (' ') 字符隐藏下面的 window?我将在稍后删除 window 并且不想破坏较低 window 上的数据(当 space 是非空字符时它可以正常工作)。

您可能指的是函数 overlay,而不是某些终端配置问题。文档同意您的意见:

The overlay and overwrite routines overlay srcwin on top of dstwin. scrwin and dstwin are not required to be the same size; only text where the two windows overlap is copied. The difference is that overlay is non-destructive (blanks are not copied) whereas overwrite is destructive.

Python的curses binding also has overwrite,听起来更像你想要的。

事实证明,我正在寻找的行为正是面板的用途。

Panels are windows with the added feature of depth, so they can be >stacked on top of each other, and only the visible portions of each window >will be displayed. Panels can be added, moved up or down in the stack, and >removed.

https://docs.python.org/2/library/curses.panel.html