tests/curses_keycodes.py
changeset 20 472a753664f9
parent 19 5e78d52ebb24
child 65 5f0697950f15
equal deleted inserted replaced
19:5e78d52ebb24 20:472a753664f9
       
     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)