[Tutor] Keyboard Module

Alan Gauld alan.gauld at btinternet.com
Wed Oct 12 09:57:42 CEST 2011


On 12/10/11 02:32, Ryan Strunk wrote:

> The keyboard module I currently have access to is a wrapper for the wx
> keyboard handler, which is fine, but it prevents me from holding one key and
> pressing another.

So use raw wx key events. They include key down,up and press events.

> I thought of using Pygame to pull this off, but I gather from my research
> that I can't just use certain pieces of Pygame; in order to get the
> functionality I want out of the keyboard module, I'll need other modules as
> well. I don't want to work specifically in Pygame, because I've heard Pygame
> is quite bloated and requires a good deal of overhead. (I wouldn't mind
> being proven wrong on this)

Bloated carries the connotation of unnecessary code, but pygame provides 
a lot of functionality. You may not need it all, and using pygame may 
require you to import more than you need. But thats not quite the same 
as saying pygame is bloated.

And its not that huge that it should stop you using it.
If it works, why not?


> All of which leads me to my question. Can anyone recommend a keyboard module
> which will allow me to work with various facets of the keyboard to execute
> functions.

Since you mentioned wx I assume thats the GUI you are using.
If not you can also investigate Tkinter which likewise traps keyboard 
events and might be considered slightly easier to use.

HTH,

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list