tests/curses_keycodes.py
changeset 65 5f0697950f15
parent 20 472a753664f9
child 110 cf3d49cdd6e2
equal deleted inserted replaced
64:03f591f5fe5c 65:5f0697950f15
    12     screen.scrollok(1)
    12     screen.scrollok(1)
    13     curses.nl()
    13     curses.nl()
    14     curses.mousemask(curses.ALL_MOUSE_EVENTS | curses.REPORT_MOUSE_POSITION)
    14     curses.mousemask(curses.ALL_MOUSE_EVENTS | curses.REPORT_MOUSE_POSITION)
    15     while True:
    15     while True:
    16         c = screen.getch()
    16         c = screen.getch()
       
    17         s = ''
    17 
    18 
    18         screen.nodelay(1)
    19         screen.nodelay(1)
    19         while c != -1:
    20         while c != -1:
       
    21             try:
       
    22                 s += chr(c)
       
    23             except ValueError:
       
    24                 s += '?'
    20             screen.addstr('0x%02x,' % c)
    25             screen.addstr('0x%02x,' % c)
    21             c = screen.getch()
    26             c = screen.getch()
    22         screen.nodelay(0)
    27         screen.nodelay(0)
    23 
    28 
    24         screen.addstr('\n')
    29         screen.addstr(' %r\n' % s)
    25 
    30 
    26         screen.refresh()
    31         screen.refresh()
    27 
    32 
    28 curses.wrapper(doStuff)
    33 curses.wrapper(doStuff)