curses newwin

Discussion in 'Python' started by Michele Simionato, Jul 31, 2003.

  1. I have just performed this experiment with curses:

    from curses import *

    maxwidth=79
    maxheight=21

    def wait4q(stdscr):
    scr=stdscr
    scr.addstr("Press '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__=='__main__':
    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
     
    Michele Simionato, Jul 31, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Skeleton Man

    curses and color

    Skeleton Man, May 25, 2004, in forum: Perl
    Replies:
    0
    Views:
    665
    Skeleton Man
    May 25, 2004
  2. Michael J. Barillier

    Curses chgat

    Michael J. Barillier, Sep 12, 2004, in forum: Perl
    Replies:
    0
    Views:
    698
    Michael J. Barillier
    Sep 12, 2004
  3. M.Senthil Kumar

    Boxline in curses ( Linux )

    M.Senthil Kumar, Feb 21, 2004, in forum: C Programming
    Replies:
    7
    Views:
    811
    Richard Bos
    Feb 23, 2004
  4. Alex

    Curses module.

    Alex, Jul 16, 2003, in forum: Python
    Replies:
    2
    Views:
    839
  5. Jean-Paul Calderone
    Replies:
    2
    Views:
    467
    Joel Hedlund
    Feb 9, 2006
Loading...

Share This Page