Keyboard: events

events
  • Returns a list of all of the keyboard keys.

Return Type:

  • list [ keycode, state]

keycode:

  • Type:  integer
state:
  • Type:  integer
  • 0 = not active
  • 1 = just pressed
  • 2 = active
  • 3 = released
Note:
  • bge.logic.keyboard does not use the Keyboard Sensor. 
Sample Code

################## get a list of the keyboard keys


# import bge
import bge

# get the keyboard
keyBoard = bge.logic.keyboard

# get a list of all of the keys
all_keys = keyBoard.events