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

Terry Reedy tjreedy at udel.edu
Wed Oct 26 19:30:18 EDT 2016


On 10/26/2016 7:18 AM, BartC wrote:

> Can tkinter do it without creating a distracting pop-up window at the
> same time?

Yes.  I already showed how on this thread.  Of course, for some text 
appications, one would be better off with a Text widget than with the 
system-specific console.

Bart, you appear to have been fortunate enough to be spoiled by learning 
programming on microcomputers, where the terminal and computer are 
combined into one unit, so that the computer, and potentially the 
programmer, have access to user input actions.  However, Python was not 
developed on, and in not limited to use on, such machines.  Today, 
ethernet-connected *nix servers have no keyboard, mouse, or even a 
directly connected terminal.

When Python was developed, standard C did not have keyboard and mouse 
functions.  (I don't know about the most recent standards.)  Keyboard 
functions on microcomputer C ports were non-standard OS-specific 
extensions.  On Unix, X windows was and is optional.

Over 20 years ago, tk was written in tcl and C to give tcl programmers 
access to X Windows graphics terminals, including user input actions. 
It has since been ported to MS Windows and Apple OSX and adopted by 
other languages, including Python, to give the same access.

-- 
Terry Jan Reedy




More information about the Python-list mailing list