Trouble with curses module in terminalemulator

Iñigo Serna inigoserna at terra.es
Sat Aug 4 18:32:21 EDT 2001


Hello Teo,

basically, the problem comes from terminal configuration.
'curses.KEY_ENTER' key code is not the same that is generated on your
terminal when you hit enter key.
Check python-list archives for a mail from Rainy titled 'curses woes' on
date July 10 2001 10:11 for a more detailed explanation.

I hope this helps you,

Iñigo Serna

El día 01 Aug 2001 07:25:45 -0700, teo escribió
> Hi all! 
> 
> When i try to catch curses.KEY_ENTER, for example, getch() returns
> something completley diffrent :)
> well, i'll give you my code and explains below.
> 
> ----------------------------------
> import curses
> 
> curses.initscr()
> win = curses.newwin(0,0,0,0)
> win.keypad(1)
> win.refresh()
> 
> while 1:
>   ch = win.getch()
>   if ch == curses.KEY_ENTER:
>     win.addstr(10,10,"Enter pressed")
>     win.refresh()
> 
> -------------------------------------
> 
> The strange thing is, that other constants work, for example
> curses.KEY_RESIZE, but no "keyboard-keys"(enter, tab, backspace)
> 
> When i run my application in pure textmode (no X server), it works,
> but when i run my app in a terminalemulator, the mapping of the keys
> failes.
> 
> Any suggestions?
> 
> Thanks,
> Teodor
> -- 
> http://mail.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list