sill at optonline.net
Wed Jul 11 16:16:30 EDT 2001
On 11 Jul 2001 01:06:29 +0200, Iñigo Serna <inigoserna at terra.es> wrote:
> El día 10 Jul 2001 12:11:39 +0400, Oleg Broytmann escribió
>> On Tue, 10 Jul 2001, Rainy wrote:
>> > while 1:
>> > c = win.getch()
>> > if c == curses.KEY_BACKSPACE:
>> > do_something()
>> > The problem is that backspace key shows up as ^? and doesn't match the above
>> > test. I also tried doing c == 14 but also without luck. I'm using
>> > curses.wrapper() here.
>> Your terminal is incorrectly configured.
>> man 5 terminfo
>> man tic
>> man stty
> you can use
> print 'key: \'%s\' <=> %c <=> 0x%X <=> %d' % (curses.keyname(c), c & 255, c, c)
Thanks! That's exactly what I needed.
> to learn the key code which is generated and then use it in your code,
> but, of course, this is the wrong way (tm).
But all curses apps use it, seeing that mutt, slrn, etc have no problem with
> In my system (a much-modified RedHat Linux 7.1 with ncurses-5.2-8),
> backspace generates code 8 (Ctrl-H) in xterm and gnome-terminal, but
> curses.KEY_BACKSPACE in rxvt.
> Iñigo Serna
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: http://silmarill.org/cymbaline
More information about the Python-list