class_docstr: A simple test canvas for drawing demo 
class_docstr_tok: ["A","simple","test","canvas","for","drawing","demo"]
code: def __init__(self):
      scene.SceneCanvas.__init__(
          self, keys="interactive", size=(800, 800)
      )
  
      self.unfreeze()
  
      self.view = self.central_widget.add_view()
      self.view.camera = scene.PanZoomCamera(
          rect=(-100, -100, 200, 200), aspect=1.0
      )
      # the left mouse button pan has to be disabled in the camera, as it
      # interferes with dragging line points
      # Proposed change in camera: make mouse buttons configurable
      self.view.camera._viewbox.events.mouse_move.disconnect(
          self.view.camera.viewbox_mouse_event
      )
  
      scene.visuals.Text(
          "Click and drag to add objects, " + "right-click to delete.",
          color="w",
          anchor_x="left",
          parent=self.view,
          pos=(20, 30),
      )
  
      self.select_arrow = EditVisual(
          parent=self.view,
          editable=False,
          on_select_callback=self.set_creation_mode,
          callback_argument=None,
      )
      arrow = scene.visuals.Arrow(
          parent=self.select_arrow,
          pos=np.array([[50, 60], [60, 70]]),
          arrows=np.array([[60, 70, 50, 60]]),
          width=5,
          arrow_size=15.0,
          arrow_type="angle_60",
          color="w",
          arrow_color="w",
          method="agg",
      )
      self.select_arrow.add_subvisual(arrow)
  
      self.rect_button = EditRectVisual(
          parent=self.view,
          editable=False,
          on_select_callback=self.set_creation_mode,
          callback_argument=EditRectVisual,
          center=[50, 120],
          width=30,
          height=30,
      )
      self.ellipse_button = EditEllipseVisual(
          parent=self.view,
          editable=False,
          on_select_callback=self.set_creation_mode,
          callback_argument=EditEllipseVisual,
          center=[50, 170],
          radius=[15, 10],
      )
  
      self.objects = []
      self.show()
      self.selected_point = None
      self.selected_object = None
      self.creation_mode = EditRectVisual
      self.mouse_start_pos = [0, 0]
      scene.visuals.GridLines(parent=self.view.scene)
      self.freeze()
  
imports: import numpy
  from vispy import app, scene
  from vispy.color import Color
label_desc: Use image node_id 1 to create a new Canvas object from inherited base classes: scene with example: obj = Canvas()