code: def __init__(self):
      self.use_shaders = True
      app.Canvas.__init__(self, size=(512, 512), keys="interactive")
      # Note: read as bytes, then decode; py2.6 compat
      with open(op.join(this_dir, "vertex_vispy.glsl"), "rb") as fid:
          vert = fid.read().decode("ASCII")
      with open(op.join(this_dir, "fragment_seed.glsl"), "rb") as f:
          frag_seed = f.read().decode("ASCII")
      with open(op.join(this_dir, "fragment_flood.glsl"), "rb") as f:
          frag_flood = f.read().decode("ASCII")
      with open(op.join(this_dir, "fragment_display.glsl"), "rb") as f:
          frag_display = f.read().decode("ASCII")
      self.programs = [
          Program(vert, frag_seed),
          Program(vert, frag_flood),
          Program(vert, frag_display),
      ]
      # Initialize variables
      # using two FBs slightly faster than switching on one
      self.fbo_to = [FrameBuffer(), FrameBuffer()]
      self._setup_textures("shape1.tga")
      vtype = np.dtype([("position", "f4", 2), ("texcoord", "f4", 2)])
      vertices = np.zeros(4, dtype=vtype)
      vertices["position"] = [
          [-1.0, -1.0],
          [-1.0, 1.0],
          [1.0, -1.0],
          [1.0, 1.0],
      ]
      vertices["texcoord"] = [
          [0.0, 0.0],
          [0.0, 1.0],
          [1.0, 0.0],
          [1.0, 1.0],
      ]
      vertices = VertexBuffer(vertices)
      for program in self.programs:
          program.bind(vertices)
      self._timer = app.Timer("auto", self.update, start=True)
  
      self.show()
  
file_path: vispy/examples/demo/gloo/jfa/jfa_vispy.py
imports: import numpy
  from os import path
  import sys
  from vispy import app
  from vispy.gloo import Program, FrameBuffer, VertexBuffer, Texture2D, set_viewport
  from vispy.io import load_data_file, imread
label_desc: Use image node_id 1 to create a new Canvas object from inherited base classes: app with example: obj = Canvas()