curses curiosity

Christopher Swingley cswingle at iarc.uaf.edu
Mon May 12 15:24:08 EDT 2003


Andrew Cooke identified the problem as one involving the cursor.  After 
putting a character in the lower right corner, the cursor is moved to 
the right of it, which is off the screen.

One seeming hack to make this work would be to do:

     #! /usr/bin/env python
 
     import curses
     import curses.wrapper
 
     def main(window):
         (max_y, max_x) = window.getmaxyx()
         window.addch(max_y - 1, max_x - 2, ord('+')) # OK
         window.addch(max_y - 2, max_x - 1, ord('+')) # OK
     #    window.addch(max_y - 1, max_x - 1, ord('+')) # ERR?
         window.insch(max_y - 1, max_x - 2, ord('+')) # OK
         window.refresh()
 
         while 1:
             c = window.getch()
             if c == ord('q'):
                 break
 
     curses.wrapper(main)

Now I've got:


                        +
                       ++

in the lower right, but I can work around this.

Is there another, more elegant way?

Thanks,

Chris
-- 
Christopher S. Swingley          email: cswingle at iarc.uaf.edu
IARC -- Frontier Program         Please use encryption.  GPG key at:
University of Alaska Fairbanks   www.frontier.iarc.uaf.edu/~cswingle/






More information about the Python-list mailing list