Re: [Tutor] key detection

2015-05-22 Thread Brandon McCaig
Dave: Sorry for the late reply, but it sounds like it could help a few people here... On Wed, May 6, 2015 at 9:39 AM, Dave Angel wrote: > Many people don't realize that you can turn on a better screen copy feature > for the CMD window (DOS box) in Windows. > > I've given up Windows, and no longe

Re: [Tutor] key detection

2015-05-06 Thread Steven D'Aprano
On Wed, May 06, 2015 at 03:24:20PM -0700, Jim Mooney Py3.4.3winXP wrote: > On 6 May 2015 at 14:08, Dave Angel wrote: > > > I don't know why you would be expecting to get a utf-8 character for the > > second byte of a function key code. It's an entirely arbitrary byte > > sequence, and not equiva

Re: [Tutor] key detection

2015-05-06 Thread Steven D'Aprano
On Tue, May 05, 2015 at 09:30:12PM -0700, Jim Mooney Py3.4.3winXP wrote: > On 5 May 2015 at 18:32, Steven D'Aprano wrote: > > > https://code.activestate.com/recipes/577977-get-single-keypress/ > > > That only has a stub for Linux, Er, look again, more closely. I happen to know the author ver

Re: [Tutor] key detection

2015-05-06 Thread Jim Mooney Py3.4.3winXP
On 6 May 2015 at 14:08, Dave Angel wrote: > I don't know why you would be expecting to get a utf-8 character for the > second byte of a function key code. It's an entirely arbitrary byte > sequence, and not equivalent to anything in Unicode, encoded or not I just didn't think of accounting for

Re: [Tutor] key detection

2015-05-06 Thread Dave Angel
On 05/06/2015 01:41 PM, Jim Mooney Py3.4.3winXP wrote: from msvcrt import * while True: if kbhit(): key = getch() if key == b'\xe0' or key == b'\000': print('special key follows') key = getch() print(str(key, encoding='utf-8')) #got

Re: [Tutor] key detection

2015-05-06 Thread Jim Mooney Py3.4.3winXP
On 6 May 2015 at 10:41, Jim Mooney Py3.4.3winXP wrote: > I went a further step from the recipes linked to above and got here >> https://pypi.python.org/pypi/readchar > > > I think that's the one that failed for me > Addendum. That only failed in python 3.4. It worked fine in python 2.7 - but I r

Re: [Tutor] key detection

2015-05-06 Thread Jim Mooney Py3.4.3winXP
On 5 May 2015 at 21:51, Mark Lawrence wrote: > On 06/05/2015 05:30, Jim Mooney Py3.4.3winXP wrote: > >> On 5 May 2015 at 18:32, Steven D'Aprano wrote: >> >> https://code.activestate.com/recipes/577977-get-single-keypress/ >>> >> >> >> That only has a stub for Linux, but I found one that does b

Re: [Tutor] key detection

2015-05-06 Thread Dave Angel
On 05/06/2015 12:02 AM, Jim Mooney Py3.4.3winXP wrote: actually worked in windows instead of using their awful screen copy. What a surprise: Many people don't realize that you can turn on a better screen copy feature for the CMD window (DOS box) in Windows. I've given up Windows, and no lon

Re: [Tutor] key detection

2015-05-05 Thread Alex Kleider
On 2015-05-05 15:36, Alan Gauld wrote: On 05/05/15 22:30, Jim Mooney Py3.4.3winXP wrote: Can python detect a keypress? The following works for my (on my Ubuntu platform) system although probably won't be of much use on a Redmond OS. #!/usr/bin/env python3 # file: 'readchar.py' """ Provides re

Re: [Tutor] key detection

2015-05-05 Thread Mark Lawrence
On 06/05/2015 00:47, Jim Mooney Py3.4.3winXP wrote: On 5 May 2015 at 15:36, Alan Gauld wrote: Can python detect a keypress? That sounds simple but is actually quite tricky since it's terminal dependent. An ancillary question. I found a readchar that purports to install in py2 and 3 but

Re: [Tutor] key detection

2015-05-05 Thread Mark Lawrence
On 06/05/2015 05:30, Jim Mooney Py3.4.3winXP wrote: On 5 May 2015 at 18:32, Steven D'Aprano wrote: https://code.activestate.com/recipes/577977-get-single-keypress/ That only has a stub for Linux, but I found one that does both. Although, alas, no IOS version: http://code.activestate.com/r

Re: [Tutor] key detection

2015-05-05 Thread Jim Mooney Py3.4.3winXP
On 5 May 2015 at 18:32, Steven D'Aprano wrote: > https://code.activestate.com/recipes/577977-get-single-keypress/ That only has a stub for Linux, but I found one that does both. Although, alas, no IOS version: http://code.activestate.com/recipes/134892-getch-like-unbuffered-character-reading-

Re: [Tutor] key detection

2015-05-05 Thread Jim Mooney Py3.4.3winXP
On 5 May 2015 at 18:35, Steven D'Aprano wrote: > Is this under Linux or another Unix? If so, > only redirects stdout, not > stderr, so you need: > > python3 setup.py 2> errors.txt > > to capture the errors. > > I have no idea if Windows works the same way. > Damn, that actually worked in windows

Re: [Tutor] key detection

2015-05-05 Thread Steven D'Aprano
On Tue, May 05, 2015 at 04:47:24PM -0700, Jim Mooney Py3.4.3winXP wrote: > An ancillary question. I found a readchar that purports to install in py2 > and 3 but fails in 3. The errors (something from the encodings module) > won't copy from the console, so I thought I could redirect them like so: >

Re: [Tutor] key detection

2015-05-05 Thread Steven D'Aprano
On Tue, May 05, 2015 at 02:30:41PM -0700, Jim Mooney Py3.4.3winXP wrote: > Can python detect a keypress? I've looked all over and can't find it. I > don't mean input('blah') and have to press Enter - just detect it directly > like Javascript does. All I find are references using msvcrt, which is >

Re: [Tutor] key detection

2015-05-05 Thread Jim Mooney Py3.4.3winXP
On 5 May 2015 at 16:47, Jim Mooney Py3.4.3winXP wrote: > But that didn't work. How can I get a printout of setup errors so I can > post them? I remembered how to copy the DOS console. Here is the error. Error wasn't in setup.py so that wouldn't have worked anyway. C:\Python34\Lib\site-packages

Re: [Tutor] key detection

2015-05-05 Thread Jim Mooney Py3.4.3winXP
On 5 May 2015 at 15:36, Alan Gauld wrote: > Can python detect a keypress? >> > > That sounds simple but is actually quite tricky > since it's terminal dependent. An ancillary question. I found a readchar that purports to install in py2 and 3 but fails in 3. The errors (something from the encodi

Re: [Tutor] key detection

2015-05-05 Thread Alan Gauld
On 05/05/15 22:30, Jim Mooney Py3.4.3winXP wrote: Can python detect a keypress? That sounds simple but is actually quite tricky since it's terminal dependent. like Javascript does. All I find are references using msvcrt, which is Msoft specific, or using tkinter - but I don't want a whacking