tests/keycodes.py
changeset 19 5e78d52ebb24
equal deleted inserted replaced
18:e6c3a5ee91aa 19:5e78d52ebb24
       
     1 #!/usr/bin/python
       
     2 # -*- coding: utf-8 -*-
       
     3 
       
     4 import curses
       
     5 import locale
       
     6 
       
     7 locale.setlocale(locale.LC_ALL,"")
       
     8 
       
     9 def doStuff(screen):
       
    10     screen.addstr('termname: %s\n' % curses.termname())
       
    11     screen.keypad(0)
       
    12     screen.scrollok(1)
       
    13     curses.nl()
       
    14     curses.mousemask(curses.ALL_MOUSE_EVENTS | curses.REPORT_MOUSE_POSITION)
       
    15     while True:
       
    16         c = screen.getch()
       
    17 
       
    18         screen.nodelay(1)
       
    19         while c != -1:
       
    20             screen.addstr('0x%02x,' % c)
       
    21             c = screen.getch()
       
    22         screen.nodelay(0)
       
    23 
       
    24         screen.addstr('\n')
       
    25 
       
    26         screen.refresh()
       
    27 
       
    28 curses.wrapper(doStuff)