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

Mike Meyer mwm at
Wed Nov 10 20:04:09 CET 2004

Matt Garman <fake at not-real.bogus> writes:

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

Yes. Show us some code, please. There are any number of bugs that
could cause this behavior, and it'd be easier to narrow things down if
we knew what you were actually doing.

Mike Meyer <mwm at>
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

More information about the Python-list mailing list