code: def __init__(self):
      app.Canvas.__init__(
          self,
          size=(600, 600),
          title="Voronoi diagram",
          keys="interactive",
      )
  
      self.ps = self.pixel_scale
  
      self.seeds = np.random.uniform(
          0, 1.0 * self.ps, size=(32, 2)
      ).astype(np.float32)
      self.colors = np.random.uniform(0.3, 0.8, size=(32, 3)).astype(
          np.float32
      )
      self.idx = 0
  
      # Set Voronoi program.
      self.program_v = gloo.Program(VS_voronoi, FS_voronoi)
      self.program_v["a_position"] = [
          (-1, -1),
          (-1, +1),
          (+1, -1),
          (+1, +1),
      ]
      # HACK: work-around a bug related to uniform arrays until
      # issue #345 is solved.
      for i in range(32):
          self.program_v["u_seeds[%d]" % i] = self.seeds[i, :]
          self.program_v["u_colors[%d]" % i] = self.colors[i, :]
  
      # Set seed points program.
      self.program_s = gloo.Program(VS_seeds, FS_seeds)
      self.program_s["a_position"] = self.seeds
      self.program_s["u_ps"] = self.ps
  
      self.activate_zoom()
  
      self.show()
  
file_path: vispy/examples/demo/gloo/voronoi.py
imports: import numpy
  from vispy import app
  from vispy import gloo
label_desc: Use image node_id 1 to create a new Canvas object from inherited base classes: app with example: obj = Canvas()