code: def __init__(self):
      app.Canvas.__init__(
          self,
          title="Grayscott Reaction-Diffusion",
          size=(512, 512),
          keys="interactive",
      )
  
      self.scale = 4
      self.comp_size = self.size
      comp_w, comp_h = self.comp_size
      dt = 1.0
      dd = 1.5
      species = {
          # name : [r_u, r_v, f, k]
          "Bacteria 1": [0.16, 0.08, 0.035, 0.065],
          "Bacteria 2": [0.14, 0.06, 0.035, 0.065],
          "Coral": [0.16, 0.08, 0.060, 0.062],
          "Fingerprint": [0.19, 0.05, 0.060, 0.062],
          "Spirals": [0.10, 0.10, 0.018, 0.050],
          "Spirals Dense": [0.12, 0.08, 0.020, 0.050],
          "Spirals Fast": [0.10, 0.16, 0.020, 0.050],
          "Unstable": [0.16, 0.08, 0.020, 0.055],
          "Worms 1": [0.16, 0.08, 0.050, 0.065],
          "Worms 2": [0.16, 0.08, 0.054, 0.063],
          "Zebrafish": [0.16, 0.08, 0.035, 0.060],
      }
      P = np.zeros((comp_h, comp_w, 4), dtype=np.float32)
      P[:, :] = species["Unstable"]
  
      UV = np.zeros((comp_h, comp_w, 4), dtype=np.float32)
      UV[:, :, 0] = 1.0
      r = 32
      UV[
          comp_h // 2 - r : comp_h // 2 + r,
          comp_w // 2 - r : comp_w // 2 + r,
          0,
      ] = 0.50
      UV[
          comp_h // 2 - r : comp_h // 2 + r,
          comp_w // 2 - r : comp_w // 2 + r,
          1,
      ] = 0.25
      UV += np.random.uniform(0.0, 0.01, (comp_h, comp_w, 4))
      UV[:, :, 2] = UV[:, :, 0]
      UV[:, :, 3] = UV[:, :, 1]
  
      self.pingpong = 1
      self.compute = Program(compute_vertex, compute_fragment, 4)
      self.compute["params"] = P
      self.compute["texture"] = UV
      self.compute["position"] = [
          (-1, -1),
          (-1, +1),
          (+1, -1),
          (+1, +1),
      ]
      self.compute["texcoord"] = [(0, 0), (0, 1), (1, 0), (1, 1)]
      self.compute["dt"] = dt
      self.compute["dx"] = 1.0 / comp_w
      self.compute["dy"] = 1.0 / comp_h
      self.compute["dd"] = dd
      self.compute["pingpong"] = self.pingpong
  
      self.render = Program(render_vertex, render_fragment, 4)
      self.render["position"] = [(-1, -1), (-1, +1), (+1, -1), (+1, +1)]
      self.render["texcoord"] = [(0, 0), (0, 1), (1, 0), (1, 1)]
      self.render["texture"] = self.compute["texture"]
      self.render["pingpong"] = self.pingpong
  
      self.fbo = FrameBuffer(
          self.compute["texture"], RenderBuffer(self.comp_size)
      )
      set_state(depth_test=False, clear_color="black")
  
      self._timer = app.Timer("auto", connect=self.update, start=True)
  
      self.show()
  
file_path: vispy/examples/demo/gloo/grayscott.py
imports: from __future__ import division
  import numpy
  from vispy.gloo import Program, FrameBuffer, RenderBuffer, set_viewport, clear, set_state
  from vispy import app
label_desc: Use image node_id 1 to create a new Canvas object from inherited base classes: app with example: obj = Canvas()