Search code examples
pythoncurses

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


Solution

  • 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