Curses and resizing windows

Chris Share usenet at
Tue Jun 22 04:45:13 CEST 2004

I've been writing an application using curses, and have been trying to
handle resizing the terminal, if running in xterm or similar. Increasing
the window size is working perfectly, however shrinking it is not
working at all. No matter how much I shrink the window, the size
returned by getmaxyx() does not change. However as soon as I increase it
again, it works fine. 

I've tracked the problem down to the fact I have created a window
derived from stdscr. A small script showing the effect is at the end of
this post. 

Can anyone suggest how to solve this problem, that doesn't involve not
making a derwin of stdscr?

I've been googling for hours, but found nothing to help.

Python version is 2.3.4 on debian testing.


import curses, sys

def init_display(stdscr):
    size = stdscr.getmaxyx()
    sys.stderr.write("Now %u x %u\n" % (size[1],size[0]))
    rootwin = stdscr.derwin(20, 50, 0, 0)
    return rootwin

def main(stdscr):
    rootwin = init_display(stdscr)
    while 1:
        input = rootwin.getch()
        if ( input == curses.KEY_RESIZE):
        elif input == ord("q"):


More information about the Python-list mailing list