[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Snow Leopard Cursor Keys broken.
From: |
Nicholas Cole |
Subject: |
Re: Snow Leopard Cursor Keys broken. |
Date: |
Thu, 8 Apr 2010 20:06:45 +0100 |
On Thu, Apr 8, 2010 at 6:28 PM, Nicholas Cole <address@hidden> wrote:
> Dear List,
>
> I'm having a strange curses problem on Mac OS 10.6.3. If I use the
> system provided python, curses applications do not correctly interpret
> arrow keys (I've tried both with xterm and with Terminal.app, so I
> don't think it is a terminal problem). If I use the version of python
> I've installed from fink, everything works as expected.
>
> This is definitely a 10.6.3 problem. When I found the problem on my
> Desktop machine, I tested 10.6.2 on my laptop and it worked fine.
> Upgrading to 10.6.3 broke the cursor keys in exactly the same way.
>
> I've attached code that demonstrates the problem. On 10.6.2 the left
> arrow key produces "KEY_LEFT". On 10.6.3 it produces "D"
While I was filling out a bug report to Apple, I realised I had sent
the wrong test code to this list. My apologies. Here is something
that will illustrate it without requiring non-standard libraries!
#!/usr/bin/python
import curses
import curses.ascii
def mainloop(scr):
while 1:
scr.keypad(1)
curses.halfdelay(100)
ch = scr.getch()
if ch == "-1": scr.addstr(2, 0, '-1')
try:
scr.erase()
scr.addstr(0,0, "%s, %s, %s" %
(curses.keyname(ch), curses.ascii.unctrl(ch), ch))
scr.addstr(1,0, str(ch))
except:
pass
scr.refresh()
if __name__ == "__main__":
# locale.setlocale(locale.LC_ALL, '')
print curses.wrapper(mainloop)