简体   繁体   English

如何使Python curses覆盖不透明?

[英]How to make Python curses overlay not transparent?

By default a Python curses overlay is transparent, where any non character space shows the window below. 默认情况下,Python curses叠加层是透明的,其中任何非字符空间都会显示下面的窗口。 Even when adding a ' ' character, it still shows the character below. 即使添加了''字符,它仍然显示下面的字符。

Is there a way to have an overlay's space (' ') characters hide the window below? 有没有办法让覆盖层的空格('')字符隐藏下面的窗口? I will be removing the window at a later point and do not want to destory the data that is on the lower window (which works correctly when the space is a non empty character). 我将在以后删除窗口,并且不希望删除下部窗口中的数据(当空格为非空字符时,该数据可以正常工作)。

Turns out the behavior I was looking for is what panels are for. 原来我想要的行为是面板的作用。

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 https://docs.python.org/2/library/curses.panel.html

Likely you are referring to the function overlay , rather than some terminal configuration issue. 您可能指的是功能overlay ,而不是某些终端配置问题。 The documentation agrees with your comment: 该文档同意您的意见:

The overlay and overwrite routines overlay srcwin on top of dstwin . 覆盖覆盖例程将srcwin覆盖在dstwin之上 scrwin and dstwin are not required to be the same size; scrwindstwin的大小不必相同; 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's curses binding also has overwrite , which sounds more like what you want. Python的curses绑定也具有overwrite ,这听起来更像您想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM