class_docstr: Custom sphinx-gallery scraper to save the current Canvas to an image.
docstr: Scrape VisPy Canvases and applications.
  
  Parameters
  ----------
  block : tuple
      A tuple containing the (label, content, line_number) of the block.
  block_vars : dict
      Dict of block variables.
  gallery_conf : dict
      Contains the configuration of Sphinx-Gallery
  
  Returns
  -------
  rst : str
      The ReSTructuredText that will be rendered to HTML containing
      the images. This is often produced by
      :func:`sphinx_gallery.scrapers.figure_rst`.
docstr_tok: ["Scrape","VisPy","Canvases","and","applications",".","Parameters","--","--","--","--","--","block",":","tuple","A","tuple","containing","the","(","label",",","content",",","line_number",")","of","the","block",".","block_vars",":","dict","Dict","of","block","variables",".","gallery_conf",":","dict","Contains","the","configuration","of","Sphinx-Gallery","Returns","--","--","--","-","rst",":","str","The","ReSTructuredText","that","will","be","rendered","to","HTML","containing","the","images",".","This","is","often","produced","by",":","func",":","`","sphinx_gallery.scrapers.figure_rst","`","."]
code: def __call__(self, block, block_vars, gallery_conf):
      """Scrape VisPy Canvases and applications.
  
      Parameters
      ----------
      block : tuple
          A tuple containing the (label, content, line_number) of the block.
      block_vars : dict
          Dict of block variables.
      gallery_conf : dict
          Contains the configuration of Sphinx-Gallery
  
      Returns
      -------
      rst : str
          The ReSTructuredText that will be rendered to HTML containing
          the images. This is often produced by
          :func:`sphinx_gallery.scrapers.figure_rst`.
  
      """
      example_fn = block_vars["src_file"]
      frame_num_list = self._get_frame_list_from_source(example_fn)
      image_path_iterator = block_vars["image_path_iterator"]
      canvas_or_widget = get_canvaslike_from_globals(
          block_vars["example_globals"]
      )
      if not frame_num_list:
          image_paths = []
      elif isinstance(frame_num_list[0], str):
          # example produces an image/animation as output
          image_paths = []
          for frame_image, image_path in zip(
              frame_num_list, image_path_iterator
          ):
              image_path = (
                  os.path.splitext(image_path)[0]
                  + os.path.splitext(frame_image)[1]
              )
              shutil.move(frame_image, image_path)
              image_paths.append(image_path)
      else:
          image_paths = self._save_example_to_files(
              canvas_or_widget,
              frame_num_list,
              gallery_conf,
              image_path_iterator,
          )
  
      fig_titles = ""  # alt text
      # FUTURE: Handle non-images (ex. MP4s) with raw HTML
      return figure_rst(
          image_paths, gallery_conf["src_dir"], fig_titles
      )
  
imports: from __future__ import annotations
  import os
  import time
  import shutil
  from vispy.io import imsave
  from vispy.gloo.util import _screenshot
  from vispy.scene import SceneCanvas
  from sphinx_gallery.scrapers import optipng, figure_rst
label_desc: Use image node_id 2 for calling the VisPyGalleryScraper obj's underlying member method code with example usage: obj.__call__(block, block_vars, gallery_conf) and returns: figure_rst