Why doesn't Python include non-blocking keyboard input function?

BartC bc at freeuk.com
Tue Oct 25 19:45:39 EDT 2016


On 25/10/2016 23:58, Chris Angelico wrote:
> On Wed, Oct 26, 2016 at 9:30 AM, BartC <bc at freeuk.com> wrote:
>>> That still doesn't answer the fundamental question:
>>>
>>> Are you looking for KEYBOARD input or TEXT input?
>>
>>
>> Does it matter that much?
>>
>> Because even if you opt for TEXT, the input (when interactive which is what
>> we're talking about) is usually chopped up into LINE events. What's the
>> difference if we want to concentrate on CHAR or KEY events instead?
>
> Yes, it does. Text does not include "Home" or "Delete", but it does
> include all manner of symbols that aren't on everyone's keyboards. It
> makes a huge difference.

Actually TXT files can include codes such as Carriage Return, Backspace 
and Tab.

> Of course, you might want to stick your head in the sand and pretend
> that every character has a button on your keyboard.

I'm not sure of the relevance of that. There isn't a 1:1 correspondence 
between key and character code. So 'a' and 'A' might both be entered by 
pressing the key marked 'A'. With, possibly, some underlying translation 
so that the 'A' key can vary locations by locale. That isn't new.

It doesn't seem to me that anyone is denying that key-at-a-time access 
is useful in a wide range of programs. They just seem to be unwilling to 
let it be it available in a simple, standard form. We are expected to 
download wxPython first.

-- 
Bartc



More information about the Python-list mailing list