saving curses screen state (putwin() and getwin() again)
Matt Garman
fake at not-real.bogus
Wed Nov 10 18:08:08 EST 2004
On Wed, 10 Nov 2004 13:04:09 -0600, Mike Meyer <mwm at mired.org> wrote:
> > 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.
>
> 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.
I was hoping that the error was well-known or obvious and that
wouldn't be necessary.
Anyway, I posted some code that exhibits this behavior on my
website, http://www.raw-sewage.net/
Specifically, download the following files (and save in a common
directory):
http://raw-sewage.net/newwin.py
http://raw-sewage.net/curseschooser.py
http://raw-sewage.net/cursescolors.py
Then run the script "newwin.py". You are initially presented with
an option menu; the selection is controlled by either the up and
down arrow keys or 'j' and 'k'.
Example run to duplicate buggy behavior:
1. Run newwin.py, arrow down to option '3', press enter
2. The screen will redraw; press 'q' to go back to the menu
3. The screen should appear in the state you left it when you
pressed enter from the option menu (i.e. choice 3 selected)
4. Now choose option 5, press enter
5. The alternate screen appears, press 'q' to quit it
6. Now, the screen will re-draw as it did in step (3) above,
i.e. choice 3 is highlighted, *not* choice 5 where you left
off
7. But, if you use the up/down arrow keys, you'll realize that
the option menu thinks it left off on choice 5 (even though
it's not highlighted).
The behavior is consistent on my Linux box, running the following
version of Python:
Python 2.3.4 (#1, Oct 17 2004, 14:17:06)
[GCC 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)]
on linux2
Thanks again!
Matt
--
Matt Garman
email at: http://raw-sewage.net/index.php?file=email
More information about the Python-list
mailing list