class_docstr: Helper to grab a series of screenshots from the current Canvas-like object.
code: def _collect_frames(self, canvas, limit=10000):
      n = 0
      while not self._done and n < limit:
          canvas.update()
          canvas.app.process_events()
          n += 1
      if n >= limit or len(self._frames_to_grab) > 0:
          raise RuntimeError("Could not collect any images")
  
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 10 for calling the FrameGrabber obj's underlying member method code with example usage: obj._collect_frames(canvas, limit) without return types