Thread: curses

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    57
    Rep Power
    12

    curses


    Trying to get a simple learning program working. It works fine except I see a cursor(which I don't want). I have tried noecho and leaveok but both don't seem to make a difference.

    My python is primitive but here goes:

    Code:
    import curses
    screen = curses.initscr()
    curses.noecho()
    
    screen.box()
    screen.leaveok(1)
    
    x=4
    y=4
    while 1:
          screen.addch(y, x, "@")
          c = screen.getch()
          if c==ord('j'): y=y+1
          elif c==ord('k'): y=y-1
          elif c==ord('h'): x=x-1
          elif c==ord('l'): x=x+1
          elif c == ord('q'): break
    Running the program just creates a box and you move around a '@' using vi keys. But the program shows a @ symbol with a blocky cursor always to the right of it.

    I have googled I have read, no luck. Help.

    Edit: added [CODE] tags...
    Last edited by netytan; January 19th, 2004 at 06:16 PM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    35
    Rep Power
    11
    Try curses.curs_set(0) to remove the cursor.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    57
    Rep Power
    12

    Thanks


    OK, I could have swore I tried that before but received an attribute error.

    But it works now, so I must have had a typo, so confused.

    But my sincere thanks.

    Bill
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Those of you on windows (me included) may be interested in the wCursors module...

    http://flangy.com/dev/python/curses/

    Basically this module seems to be a clone of Pythons core cursor module for windows

    Mark.
    programming language development: www.netytan.com Hula


IMN logo majestic logo threadwatch logo seochat tools logo