(self, key, action, modifiers)
Handles a single key press (mouse and keyboard).
Handles a single key press (mouse and keyboard).
Handles a single key press ( mouse and keyboard ) .
def _handle_key(self, key, action, modifiers):
    """Handles a single key press (mouse and keyboard)."""
    alias_key = (key, modifiers)

    exclusive_key, exclusive_callback = self._active_exclusive
    if exclusive_key is not None:
      if action == RELEASE and key == exclusive_key:
        exclusive_callback(False)
        self._active_exclusive = _NO_EXCLUSIVE_KEY
    else:
      is_exclusive, callback = self._action_callbacks.get(
          alias_key, _NO_CALLBACK)
      if callback:
        if action == PRESS:
          if is_exclusive:
            callback(True)
            self._active_exclusive = (key, callback)
          else:
            callback()
def _handle_key ( self , key , action , modifiers ) : alias_key = ( key , modifiers ) exclusive_key , exclusive_callback = self . _active_exclusive if exclusive_key is not None : if action == RELEASE and key == exclusive_key : exclusive_callback ( False ) self . _active_exclusive = _NO_EXCLUSIVE_KEY else : is_exclusive , callback = self . _action_callbacks . get ( alias_key , _NO_CALLBACK ) if callback : if action == PRESS : if is_exclusive : callback ( True ) self . _active_exclusive = ( key , callback ) else : callback ( )