Key Bindings

I am working on my game engine based addon for blender, and I want to implement custom keys for player control. Instead of hardcoding each and every key, I want to implement the ‘key’ field of this logic brick:


Does anyone know how to do this?

I’ve found a similar button that I can edit the source on, but I don’t under stand it, it’s in user preferences under input:

Got it! Now I need to know how to exclude certain items from this property:


obj = context.object
        kmi = obj.game.sensors['key']
row.prop(kmi, "key")