code: def get_canvaslike_from_globals(globals_dict):
      qt_widget = _get_qt_top_parent(globals_dict)
      if qt_widget is not None:
          return qt_widget
  
      # Get canvas
      if "canvas" in globals_dict:
          return globals_dict["canvas"]
      if "Canvas" in globals_dict:
          return globals_dict["Canvas"]()
      if "fig" in globals_dict:
          return globals_dict["fig"]
      return None
  
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 1 for calling a global function with example usage: get_canvaslike_from_globals(globals_dict) and returns: None, qt_widget, globals_dict, globals_dict, globals_dict