code: def on_draw(self, event):
      # Render in the FBO.
      with self._fbo:
          gloo.clear("black")
          gloo.set_viewport(0, 0, *self.size)
          self.program.draw()
          # Retrieve the contents of the FBO texture.
          self.im = _screenshot((0, 0, self.size[0], self.size[1]))
      self._time = time() - self._t0
      # Immediately exit the application.
      app.quit()
  
file_path: vispy/examples/demo/gloo/offscreen.py
imports: from vispy import gloo
  from vispy import app
  from vispy.util.ptime import time
  from vispy.gloo.util import _screenshot
label_desc: Use image node_id 2 for calling the Canvas obj's underlying member method code with example usage: obj.on_draw(event) without return types