Please help with python and "curses"!

Joseph A Knapka jknapka at earthlink.net
Mon Jan 28 15:22:42 EST 2002


Antaeus Feldspar wrote:
> 
> I've only recently started working with the curses module,
which was
> installed for me along with Python 1.5.2 .  I have two
tutorials that
> I've been reading from, but both of them have been advising me
to use
> functions that don't appear to work.  The following Python
script should
> indicate two places I'm having trouble:
> 
> #! /usr/bin/python
> 
> import curses
> 
> stdscr = curses.initscr()
> # start_color()
> curses.noecho()
> stdscr.keypad(1) # Turns on keypad mode
> 
> stdscr.box()
> 
> secondwin = curses.newwin(10,10,2,1)
> secondwin.box()

Reverse these calls.

> secondwin.refresh()
> stdscr.refresh()

refresh() appears to redraw the entire window, ignoring subwindows.
This is not very useful :-) I found the notion of "window" in
curses to be so odd and unuseful that when implementing the
curses binding for Anygui, I just wrote my own layered-windowing
routines, drawing directly into sdtscr and using curses for
nothing more than screen addressing.

HTH,

-- Joe
"I should like to close this book by sticking out any part of my neck
 which is not yet exposed, and making a few predictions about how the
 problem of quantum gravity will in the end be solved."
 --- Physicist Lee Smolin, "Three Roads to Quantum Gravity"



More information about the Python-list mailing list