about summary refs log tree commit diff stats
path: root/doc/tools/print_keys.py
blob: ea2b1a4e3a47a9e2475cb8d9d6112ce40e1a1c69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python
"""
You can use this tool to find out values of keypresses
"""

from curses import *

sep = '; '


@wrapper
def main(w):
    mousemask(ALL_MOUSE_EVENTS)
    mouseinterval(0)
    while True:
        ch = w.getch()
        if ch == KEY_MOUSE:
            w.addstr(repr(getmouse()) + sep)
        else:
            w.addstr(str(ch) + sep)