code: def on_key_press(event):
      global opaque_cmap, translucent_cmap
      if event.text == "1":
          cam_toggle = {cam1: cam2, cam2: cam3, cam3: cam1}
          view.camera = cam_toggle.get(view.camera, cam2)
          print(view.camera.name + " camera")
          if view.camera is cam2:
              axis.visible = True
          else:
              axis.visible = False
      elif event.text == "2":
          methods = ["mip", "translucent", "iso", "additive"]
          method = methods[(methods.index(volume1.method) + 1) % 4]
          print("Volume render method: %s" % method)
          cmap = (
              opaque_cmap
              if method in ["mip", "iso"]
              else translucent_cmap
          )
          volume1.method = method
          volume1.cmap = cmap
          volume2.method = method
          volume2.cmap = cmap
      elif event.text == "3":
          volume1.visible = not volume1.visible
          volume2.visible = not volume1.visible
      elif event.text == "4":
          if volume1.method in ["mip", "iso"]:
              cmap = opaque_cmap = next(opaque_cmaps)
          else:
              cmap = translucent_cmap = next(translucent_cmaps)
          volume1.cmap = cmap
          volume2.cmap = cmap
      elif event.text == "5":
          interp = next(interp_methods)
          volume1.interpolation = interp
          volume2.interpolation = interp
          print(f"Interpolation method: {interp}")
      elif event.text == "0":
          cam1.set_range()
          cam3.set_range()
      elif event.text != "" and event.text in "[]":
          s = -0.025 if event.text == "[" else 0.025
          volume1.threshold += s
          volume2.threshold += s
          th = (
              volume1.threshold
              if volume1.visible
              else volume2.threshold
          )
          print("Isosurface threshold: %0.3f" % th)
  
file_path: vispy/examples/scene/volume.py
imports: from itertools import cycle
  import numpy
  from vispy import app, scene, io
  from vispy.color import get_colormaps, BaseColormap
  from vispy.visuals.transforms import STTransform
label_desc: Use image node_id 2 for calling a global function with example usage: on_key_press(event) without return types