ncurses' Dark Devilry
jeremy at emperorlinux.com
Tue Nov 29 22:08:13 CET 2005
On Tue, 2005-11-29 at 20:50 +0000, Tony Nelson wrote:
> In article <mailman.1336.1133289146.18701.python-list at python.org>,
> Jeremy Moles <jeremy at emperorlinux.com> wrote:
> > I'm working on a project using ncurses w/ Python. As an aside, I
> > implemented addchstr in the cursesmodule.c file in Python SVN, if anyone
> > wants me to try and get that made permanent.
> > AT ANY RATE...
> > I was wondering--and this is more a general curses question rather than
> > a Python one, but I know there are some old-timers here who have made
> > curses obey before--is there a way to "repaint" a portion of screen
> > without stealing the "cursor?" That is:
> > I have a focus "wheel" of sorts that allows the user to do input on
> > various wigets and windows and whatnot. However, if I want to quickly
> > call addstr somewhere else in the application I have to:
> > 1. Store the YX coords of the cursor currently
> > 2. Use the cursor in the "current" action
> > 3. Restore the old cursor location
> > I know there are ways around this as I have seen curses apps that, for
> > example, have a clock that updates every second without stealing
> > "focus."
> > I tried implementing/using addchstr (mentioned above) to no success.
> > Any ideas? Is this just the plain wrong place to ask this? :)
> I've only tried to read the Python Library Curses docs, but I thought
> that the Window object method addstr() would do what you want.
Perhaps I should have been more specific. :)
addstr (or any of it's brothers, even those bound to a subwin instance)
write values to an internal buffer/object that then gets flipped
(refreshed()) onto the physical screen.
All of the routines I can find in the ncurses library want to take
control of the "cursor" object. That is: they either want to advance
it's position (addstr) or not (addchstr), but they both certainly grab
"control" of it; at least, visually.
Basically what I'm looking for is a way to refresh a portion of a
curses-controlled "window" without affecting the current location of the
cursor or having to manually move it and move it back.
More information about the Python-list