code: def __init__(self):
      app.Canvas.__init__(self, keys="interactive", size=(800, 800))
      # Create several visuals demonstrating different features of Line
      self.lines = [
          # agg-method lines:
          # per-vertex color
          visuals.LineVisual(pos=pos, color=color, method="agg"),
          # solid
          visuals.LineVisual(
              pos=pos, color=(0, 0.5, 0.3, 1), method="agg"
          ),
          # wide
          visuals.LineVisual(
              pos=pos, color=color, width=5, method="agg"
          ),
          # GL-method lines:
          visuals.LineVisual(pos=pos, color=color, method="gl"),
          visuals.LineVisual(
              pos=pos, color=(0, 0.5, 0.3, 1), method="gl"
          ),
          visuals.LineVisual(
              pos=pos, color=color, width=5, method="gl"
          ),
          # GL-method: "connect" not available in AGG method yet
          # only connect alternate vert pairs
          visuals.LineVisual(
              pos=pos,
              color=(0, 0.5, 0.3, 1),
              connect="segments",
              method="gl",
          ),
          # connect specific pairs
          visuals.LineVisual(
              pos=pos,
              color=(0, 0.5, 0.3, 1),
              connect=connect,
              method="gl",
          ),
      ]
      counts = [0, 0]
      for i, line in enumerate(self.lines):
          # arrange lines in a grid
          tidx = line.method == "agg"
          x = 400 * tidx
          y = 140 * (counts[tidx] + 1)
          counts[tidx] += 1
          line.transform = STTransform(translate=[x, y])
          # redraw the canvas if any visuals request an update
          line.events.update.connect(lambda evt: self.update())
  
      self.texts = [
          visuals.TextVisual(
              "GL", bold=True, font_size=24, color="w", pos=(200, 40)
          ),
          visuals.TextVisual(
              "Agg", bold=True, font_size=24, color="w", pos=(600, 40)
          ),
      ]
      for text in self.texts:
          text.transform = NullTransform()
      self.visuals = self.lines + self.texts
      self.show()
  
file_path: vispy/examples/basics/visuals/line.py
imports: from __future__ import division
  import sys
  import numpy
  from vispy import app, gloo, visuals
  from vispy.visuals.transforms import STTransform, NullTransform
label_desc: Use image node_id 1 to create a new Canvas object from inherited base classes: app with example: obj = Canvas()