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

Michael Torrie torriem at gmail.com
Tue Oct 25 22:37:25 EDT 2016


On 10/25/2016 10:22 AM, Steve D'Aprano wrote:
> So how would you do non-blocking keyboard input? How would it work? What
> would be the interface?

Curses must allow you to do this because I've seen text-mode games made
in curses and you could do things with arrow keys, etc, all while ascii
animation was going on.  Now it could be that curses forces you into an
event-driven paradigm.  Not sure about that. But even if it did, your
event loop could run a callback that would deposit keystrokes (if any)
into another buffer of some kind that your non-event-driven thread could
peak into.




More information about the Python-list mailing list