[Tutor] key detection

Mark Lawrence breamoreboy at yahoo.co.uk
Wed May 6 06:53:58 CEST 2015


On 06/05/2015 00:47, Jim Mooney Py3.4.3winXP wrote:
> On 5 May 2015 at 15:36, Alan Gauld <alan.gauld at btinternet.com> 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 encodings module)
> won't copy from the console, so I thought I could redirect them like so:
>
> python3 setup.py > errors.txt
>
> But that didn't work. How can I get a printout of setup errors so I can
> post them? That's something of general use aside from the keyboard loop.
> Otherwise, I decided to just use msvcrt for now, which is quite simple, and
> put in a try block for win or linux, when I dual boot linux, which I'm
> working on. (solving the usual driver problems for a toshiba laptop)
>
>

You may find life far easier on Windows with http://conemu.github.io/

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Tutor mailing list