curses newwin

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michele Simionato

    curses newwin

    I have just performed this experiment with curses:

    from curses import *

    maxwidth=79
    maxheight=21

    def wait4q(stdscr):
    scr=stdscr
    scr.addstr("Pre ss 'q' to exit\n")
    x,y,=0,0
    while True:
    c=scr.getch()
    if c==KEY_LEFT and x > 0:
    x-=1; scr.move(y,x)
    elif c==KEY_RIGHT and x < maxwidth:
    x+=1; scr.move(y,x)
    elif c==KEY_UP and y > 0:
    y-=1; scr.move(y,x)
    elif c==KEY_DOWN and y < maxheight:
    y+=1; scr.move(y,x)
    elif c==ord('q'):
    break

    if __name__=='__ma in__':
    wrapper(wait4q)

    It works fine and one can move the cursor on the screen. The question
    is: why that does not work for a generic window different from stdscr?
    i.e. if I replace the line ``scr=stdscr`` with
    ``scr=newwin(0, 0)``I don't see the cursor moving anymore.
    The 'q' is still recognized, however. I tried with some
    refresh(), but didn't work. What I am missing?

    TIA,

    Michele
Working...