Tool for seeing what key is pressed
authorJohn Ladan <jladan@uwaterloo.ca>
Sat, 17 Mar 2012 01:26:51 +0000 (21:26 -0400)
committerJohn Ladan <jladan@uwaterloo.ca>
Sat, 17 Mar 2012 01:26:51 +0000 (21:26 -0400)
echokey.py [new file with mode: 0755]

diff --git a/echokey.py b/echokey.py
new file mode 100755 (executable)
index 0000000..efab2c0
--- /dev/null
@@ -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)