code: def __init__(self):
      super(Window, self).__init__()
      box = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight, self)
      self.resize(500, 200)
      self.setLayout(box)
  
      self.canvas_0 = SceneCanvas(bgcolor="w")
      self.vb_0 = ViewBox(parent=self.canvas_0.scene, bgcolor="r")
      self.vb_0.camera.rect = -1, -1, 2, 2
      self.canvas_0.events.initialize.connect(self.on_init)
      self.canvas_0.events.resize.connect(
          partial(on_resize, self.canvas_0, self.vb_0)
      )
      box.addWidget(self.canvas_0.native)
  
      # pass the context from the first canvas to the second
      self.canvas_1 = SceneCanvas(
          bgcolor="w", shared=self.canvas_0.context
      )
      self.vb_1 = ViewBox(parent=self.canvas_1.scene, bgcolor="b")
      self.vb_1.camera.rect = -1, -1, 2, 2
      self.canvas_1.events.resize.connect(
          partial(on_resize, self.canvas_1, self.vb_1)
      )
      box.addWidget(self.canvas_1.native)
  
      self.tick_count = 0
      self.timer = Timer(
          interval=1.0, connect=self.on_timer, start=True
      )
      self.setWindowTitle("Shared contexts")
      self.show()
  
file_path: vispy/examples/tutorial/app/shared_context.py
imports: from PyQt5 import QtWidgets, QtCore
  from functools import partial
  from vispy.app import Timer
  from vispy.scene.visuals import Text
  from vispy.scene.widgets import ViewBox
  from vispy.scene import SceneCanvas
label_desc: Use image node_id 1 to create a new Window object from inherited base classes: QtWidgets with example: obj = Window()