keypressed() function

Ravi Teja webraviteja at gmail.com
Thu Dec 28 20:40:28 EST 2006


pinkfloydhomer at gmail.com wrote:
> I need a function (blocking or non-blocking) that tells me if a key has
> been pressed (even before it has been released etc.). Also, I would of
> course like to know _which_ key has been pressed.
>
> I know that this probably does not exist in the Python library already
> as a platform-independant abstraction (even though it probably could),
> but then I would at least like solutions that works on Windows and on
> Linux.

Hmm.. 2 questions on this today. On Windows PyHook will work. It
signals for both Key Up and Key Down events. However it is a Windows
only module making use of very platform specific API. I am not sure if
there is an equivalent for Linux.




More information about the Python-list mailing list