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

Matt Garman fake at not-real.bogus
Tue Nov 9 23:48:54 EST 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
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?

Thanks!
Matt

-- 
Matt Garman
email at: http://raw-sewage.net/index.php?file=email



More information about the Python-list mailing list