saving curses screen state (putwin() and getwin() again)

Matt Garman fake at not-real.bogus
Wed Nov 10 05:48:54 CET 2004

I'm working on a curses-based application in Python.  I've
implemented what I call a "Chooser" (a fancy name for a menu):

        ---> 1. Choice 1 <---
             2. Choice 2     
             3. Choice 3     

So the user can use the arrow keys to change choices.  When he hits
enter, the screen is re-drawn with a new interface.  When that
interface is quit, the screen should return to the Chooser, exactly
as it was left.

So my strategy is to call putwin() before going to the new
interface, and call getwin() after returning from the previous

This works as described the *first* time, but subsequent calls to
getwin() return the window that was saved with the first call to
putwin().  I.e., it's as though only the first call to putwin() has
any effect.

Any thoughts?


Matt Garman
email at:

More information about the Python-list mailing list