tests/curses_keycodes.py
author Radek Brich <radek.brich@devl.cz>
Mon, 10 Oct 2011 22:20:59 +0200
changeset 25 f69a1f0382ce
parent 20 472a753664f9
child 65 5f0697950f15
permissions -rwxr-xr-x
Partial DriverPygame.putch() implementation. Add patch for PyGame implementing font.render_glyph(). Add test for PyGame font module. Add special key definitions to DriverPygame.

#!/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)