class_docstr: Custom sphinx-gallery scraper to save the current Canvas to an image.
code: def _save_example_to_files(
      self,
      canvas_or_widget,
      frame_num_list,
      gallery_conf,
      image_path_iterator,
  ):
      image_path = next(image_path_iterator)
      frame_grabber = FrameGrabber(canvas_or_widget, frame_num_list)
      frame_grabber.collect_frames()
      if len(frame_num_list) > 1:
          # let's make an animation
          # FUTURE: mp4 with imageio?
          image_path = os.path.splitext(image_path)[0] + ".gif"
          frame_grabber.save_animation(image_path)
      else:
          frame_grabber.save_frame(image_path)
      frame_grabber.cleanup()
      if "images" in gallery_conf["compress_images"]:
          optipng(image_path, gallery_conf["compress_images_args"])
      return [image_path]
  
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 3 for calling the VisPyGalleryScraper obj's underlying member method code with example usage: obj._save_example_to_files(canvas_or_widget, frame_num_list, gallery_conf, image_path_iterator) and returns: list