class_docstr: Glfw backend for Canvas abstract class.
class_docstr_tok: ["Glfw","backend","for","Canvas","abstract","class","."]
code: def _on_key_press(self, _id, key, scancode, action, mod):
      if self._vispy_canvas is None:
          return
      key, text = self._process_key(key)
      if action == glfw.PRESS:
          fun = self._vispy_canvas.events.key_press
          down = True
      elif action == glfw.RELEASE:
          fun = self._vispy_canvas.events.key_release
          down = False
      else:
          return
      self._process_mod(key, down=down)
  
      # NOTE: GLFW only provides localized characters via _on_key_char, so if
      # this event contains a character we store all other data and dispatch
      # it once the final unicode character is sent shortly after.
      if text != "" and action == glfw.PRESS:
          self._next_key_events.append((fun, key, self._mod))
      else:
          if key in self._next_key_text:
              text = self._next_key_text[key]
              del self._next_key_text[key]
          fun(key=key, text=text, modifiers=self._mod)
  
imports: from __future__ import division
  import atexit
  from time import sleep
  import gc
  import os
  from ..base import BaseApplicationBackend, BaseCanvasBackend, BaseTimerBackend
  from ...util import keys, logger
  from ...util.ptime import time
  from ...None import config
label_desc: Use image node_id 22 for calling the CanvasBackend obj's underlying member method code with example usage: obj._on_key_press(_id, key, scancode, action, mod) without return types