tests/keycodes.py
changeset 19 5e78d52ebb24
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/keycodes.py	Fri Oct 07 12:02:33 2011 +0200
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import curses
+import locale
+
+locale.setlocale(locale.LC_ALL,"")
+
+def doStuff(screen):
+    screen.addstr('termname: %s\n' % curses.termname())
+    screen.keypad(0)
+    screen.scrollok(1)
+    curses.nl()
+    curses.mousemask(curses.ALL_MOUSE_EVENTS | curses.REPORT_MOUSE_POSITION)
+    while True:
+        c = screen.getch()
+
+        screen.nodelay(1)
+        while c != -1:
+            screen.addstr('0x%02x,' % c)
+            c = screen.getch()
+        screen.nodelay(0)
+
+        screen.addstr('\n')
+
+        screen.refresh()
+
+curses.wrapper(doStuff)