ncurses pad question

Mag Gam magawake at gmail.com
Wed Sep 22 00:04:24 CEST 2010


I am having some trouble understanding how padding/windowing works for
Python curses. According to this example on
http://docs.python.org/howto/curses.html I see:

pad = curses.newpad(100, 100)
#  These loops fill the pad with letters; this is
# explained in the next section
for y in range(0, 100):
    for x in range(0, 100):
        try: pad.addch(y,x, ord('a') + (x*x+y*y) % 26 )
        except curses.error: pass

#  Displays a section of the pad in the middle of the screen
pad.refresh( 0,0, 5,5, 20,75)

Now if I want another pad, lets call it:

pad1=curses.newpad(100,300)

pad1.addch(0,0,ord('X'))

pad1.refresh(0,0,120,120,110,130)


For some reason I get,
pad1.refresh(0,0,120,130,140,180) _curses.error:prefresh() return ERR

Any ideas?



More information about the Python-list mailing list