Feature or enhancement
The :mod:curses module does not expose the ncurses key-management extensions define_key(), key_defined() and keyok().
These let an application manage how curses recognizes control strings as keycodes, beyond the predefined terminfo keys and the all-or-nothing :meth:curses.window.keypad.
define_key(definition, keycode) binds the control string definition to keycode. If definition is None the binding for keycode is removed; if keycode is zero or negative the binding for definition is removed.
key_defined(definition) returns the keycode bound to definition, 0 if none is, or -1 if definition is ambiguous.
keyok(keycode, enable) enables or disables recognition of a single keycode, a finer-grained alternative to :meth:curses.window.keypad.
Proposed API:
curses.define_key(definition, keycode)
curses.key_defined(definition) -> int
curses.keyok(keycode, enable)
These are ncurses extensions, available when built against an ncurses with NCURSES_EXT_FUNCS.
Linked PRs
Feature or enhancement
The :mod:
cursesmodule does not expose the ncurses key-management extensionsdefine_key(),key_defined()andkeyok().These let an application manage how curses recognizes control strings as keycodes, beyond the predefined terminfo keys and the all-or-nothing :meth:
curses.window.keypad.define_key(definition, keycode)binds the control string definition to keycode. If definition isNonethe binding for keycode is removed; if keycode is zero or negative the binding for definition is removed.key_defined(definition)returns the keycode bound to definition,0if none is, or-1if definition is ambiguous.keyok(keycode, enable)enables or disables recognition of a single keycode, a finer-grained alternative to :meth:curses.window.keypad.Proposed API:
curses.define_key(definition, keycode)curses.key_defined(definition)->intcurses.keyok(keycode, enable)These are ncurses extensions, available when built against an ncurses with
NCURSES_EXT_FUNCS.Linked PRs