class_docstr: Pyglet backend for Canvas abstract class.
class_docstr_tok: ["Pyglet","backend","for","Canvas","abstract","class","."]
code: def __init__(self, vispy_canvas, **kwargs):
      BaseCanvasBackend.__init__(self, vispy_canvas)
      p = self._process_backend_kwargs(kwargs)
  
      # Deal with config
      config = _set_config(p.context.config)  # Also used further below
      # Deal with context
      p.context.shared.add_ref("pyglet", self)
      # contexts are shared by default in Pyglet
  
      style = (
          pyglet.window.Window.WINDOW_STYLE_DEFAULT
          if p.decorate
          else pyglet.window.Window.WINDOW_STYLE_BORDERLESS
      )
      # We keep track of modifier keys so we can pass them to mouse_motion
      self._current_modifiers = set()
      # self._buttons_accepted = 0
      self._draw_ok = False  # whether it is ok to draw yet
      self._pending_position = None
      if p.fullscreen is not False:
          screen = pyglet.window.get_platform().get_default_display()
          self._vispy_fullscreen = True
          if p.fullscreen is True:
              self._vispy_screen = screen.get_default_screen()
          else:
              screen = screen.get_screens()
              if p.fullscreen >= len(screen):
                  raise RuntimeError(
                      "fullscreen must be < %s" % len(screen)
                  )
              self._vispy_screen = screen[p.fullscreen]
      else:
          self._vispy_fullscreen = False
          self._vispy_screen = None
      self._initialize_sent = False
      pyglet.window.Window.__init__(
          self,
          width=p.size[0],
          height=p.size[1],
          caption=p.title,
          visible=p.show,
          config=config,
          vsync=p.vsync,
          resizable=p.resizable,
          style=style,
          screen=self._vispy_screen,
      )
      if p.position is not None:
          self._vispy_set_position(*p.position)
  
imports: from __future__ import division
  from packaging.version import Version
  from time import sleep
  from ..base import BaseApplicationBackend, BaseCanvasBackend, BaseTimerBackend
  from ...util import keys
  from ...util.ptime import time
  from ...None import config
label_desc: Use image node_id 1 to create a new CanvasBackend object from inherited base classes: BaseCanvasBackend, _Window with example: obj = CanvasBackend(vispy_canvas)