def _onPygletKey(symbol, modifiers, emulated=False):
 global useText
 keyTime = psychopy.core.getTime()
 if emulated:
  thisKey = unicode(symbol)
  keySource = 'EmulatedKey'
 else:
  thisKey = pyglet.window.key.symbol_string(symbol).lower()
  if ('user_key' in thisKey):
   useText = True
   return
  useText = False
  thisKey = thisKey.lstrip('_').lstrip('NUM_')
  keySource = 'Keypress'
 _keyBuffer.append((thisKey, modifiers, keyTime))
 logging.data(('%s: %s' % (keySource, thisKey)))

def _onPygletKey ( symbol , modifiers , emulated = False ) : global useText keyTime = psychopy . core . getTime ( ) if emulated : thisKey = unicode ( symbol ) keySource = 'EmulatedKey' else : thisKey = pyglet . window . key . symbol_string ( symbol ) . lower ( ) if ( 'user_key' in thisKey ) : useText = True return useText = False thisKey = thisKey . lstrip ( '_' ) . lstrip ( 'NUM_' ) keySource = 'Keypress' _keyBuffer . append ( ( thisKey , modifiers , keyTime ) ) logging . data ( ( '%s: %s' % ( keySource , thisKey ) ) )
handler for on_key_press pyglet events; call directly to emulate a key press appends a tuple with into the global _keybuffer .