
- 13 or bge.events.ENTERKEY
- 124 or bge.events.LEFTCTRLKEY
- 125 or bge.events.LEFTALTKEY
- 129 or bge.events.LEFTSHIFTKEY
- 13 or bge.events.RETKEY
- 126 or bge.events.RIGHTALTKEY
- 127 or bge.events.RIGHTCTRLKEY
- 128 or bge.events.RIGHTSHIFTKEY
- 32 or bge.events.SPACEKEY

################ get the Key Code for the key triggering the keyboard sensor
# import bge module
import bge
# get the python controller
cont = bge.logic.getCurrentController()
# get the keyboard sensor
# My keyboard sensor is named Keyboard_1
sen = cont.sensors["Keyboard_1"]
# get the keycode of the key that triggers sensor
keyCode = sen.key
################ set the Key Code for the key triggering the keyboard sensor
# import bge module
import bge
# get the python controller
cont = bge.logic.getCurrentController()
# get the keyboard sensor
# My keyboard sensor is named Keyboard_1
sen = cont.sensors["Keyboard_1"]
# use the left shift key to trigger the keyboard sensor
# Left Shift key: 129 or bge.events.LEFTSHIFTKEY
sen.key = bge.events.LEFTSHIFTKEY