简体   繁体   中英

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. 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

Likely you are referring to the function overlay , rather than some terminal configuration issue. The documentation agrees with your comment:

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's curses binding also has overwrite , which sounds more like what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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