[Tutor] Re: Curses Programming

Lee Harr missive at hotmail.com
Sat Nov 15 00:37:29 EST 2003


>i am looking for a tutorial on curses other than the famous two:

>Actually i would want to have :
>
>a) tab and arrow based movements between fields


Two things I learned while working with curses:

1. You can't just print values to debug your program  :o)
2. Systems return different values for the same keys
     (even the same operating system on different hardware)


Maybe this will help you:

# keyvalues.py
import logging
import curses

logger = logging.getLogger()
hdlr = logging.FileHandler('keyvalues.log')
logger.addHandler(hdlr)
logger.setLevel(logging.INFO)

def main(scr):
    ch = scr.getch()
    while ch != ord(' '): # press space bar to exit
        logger.info(ch)
        ch = scr.getch()

curses.wrapper(main)

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus




More information about the Tutor mailing list