Tool for seeing what key is pressed

This commit is contained in:
John Ladan 2012-03-16 21:26:51 -04:00
parent 3408432055
commit a952402a7a
1 changed files with 19 additions and 0 deletions

19
echokey.py Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env python
import curses
def echokey(w):
curses.noecho()
w.keypad(1)
curses.cbreak()
w.addstr(19,20, "value")
w.addstr(19,40, "name")
ch=w.getch()
while (1==1):
w.addstr(20,20,str(ch))
w.addstr(20,40,curses.keyname(ch))
ch = w.getch()
w.deleteln()
curses.wrapper(echokey)