summary refs log blame commit diff stats
path: root/doc/tools/print_keys.py
blob: cf915591066eb0ce0df61d89650003c8c54e52a2 (plain) (tree)
1
2
3
4
5
6
7
8
9
                     



                                                      
             
 
 
                
 




                                             
               


                                                              
             
                                                
#!/usr/bin/env python
"""
You can use this tool to find out values of keypresses
"""

import curses


SEPARATOR = '; '


@curses.wrapper
def main(window):
    curses.mousemask(curses.ALL_MOUSE_EVENTS)
    curses.mouseinterval(0)
    while True:
        char = window.getch()
        if char == curses.KEY_MOUSE:
            window.addstr(repr(curses.getmouse()) + SEPARATOR)
        else:
            window.addstr(str(char) + SEPARATOR)