Send alt key to subprocess.PIPE stdin

Nobody nobody at nowhere.com
Thu Sep 12 13:20:14 EDT 2013


On Fri, 13 Sep 2013 01:27:53 +1000, Chris Angelico wrote:

> That said, though: These sorts of keystrokes often can be represented
> with escape sequences (I just tried it in xterm and Alt-D came out as
> "\e[d"),

Technically, that would be Meta-D (even if your Meta key has "Alt" printed
on it).

Alt-<char> produces chr(ord(char)+128); Meta-<char> produces "\e"+char.

At least, that's the historical distinction between Meta and Alt. With
xterm, the behaviour is configurable via the resources altIsNotMeta,
altSendsEscape and metaSendsEscape.

None of which has anything to do with trying to feed a GUI program key
events via stdin ...




More information about the Python-list mailing list