class_docstr: Provides a rectangular widget to which its subscene is rendered.
  
  Three classes work together when using a ViewBox:
  * The :class:`SubScene` class describes a "world" coordinate system and the
  entities that live inside it.
  * ViewBox is a "window" through which we view the
  subscene. Multiple ViewBoxes may view the same subscene.
  * :class:`Camera` describes both the perspective from which the
  subscene is rendered, and the way user interaction affects that
  perspective.
  
  In general it is only necessary to create the ViewBox; a SubScene and
  Camera will be generated automatically.
  
  Parameters
  ----------
  camera : instance of Camera | str | None
      The camera through which to view the SubScene. If None, then a
      PanZoomCamera (2D interaction) is used. If str, then the string is
      used as the argument to :func:`make_camera`.
  **kwargs : dict
      Extra keyword arguments to pass to `Widget`.
class_docstr_tok: ["Provides","a","rectangular","widget","to","which","its","subscene","is","rendered",".","Three","classes","work","together","when","using","a","ViewBox",":","*","The",":","class",":","`","SubScene","`","class","describes","a","``","world","''","coordinate","system","and","the","entities","that","live","inside","it",".","*","ViewBox","is","a","``","window","''","through","which","we","view","the","subscene",".","Multiple","ViewBoxes","may","view","the","same","subscene",".","*",":","class",":","`","Camera","`","describes","both","the","perspective","from","which","the","subscene","is","rendered",",","and","the","way","user","interaction","affects","that","perspective",".","In","general","it","is","only","necessary","to","create","the","ViewBox",";","a","SubScene","and","Camera","will","be","generated","automatically",".","Parameters","--","--","--","--","--","camera",":","instance","of","Camera","|","str","|","None","The","camera","through","which","to","view","the","SubScene",".","If","None",",","then","a","PanZoomCamera","(","2D","interaction",")","is","used",".","If","str",",","then","the","string","is","used","as","the","argument","to",":","func",":","`","make_camera","`",".","*","*","kwargs",":","dict","Extra","keyword","arguments","to","pass","to","`","Widget","`","."]
docstr: Get the total bounds based on the visuals present in the scene
  
  Parameters
  ----------
  dim : int | None
      Dimension to return.
  
  Returns
  -------
  bounds : list | tuple
      If ``dim is None``, Returns a list of 3 tuples, otherwise
      the bounds for the requested dimension.
docstr_tok: ["Get","the","total","bounds","based","on","the","visuals","present","in","the","scene","Parameters","--","--","--","--","--","dim",":","int","|","None","Dimension","to","return",".","Returns","--","--","--","-","bounds",":","list","|","tuple","If","``","dim","is","None","``",",","Returns","a","list","of","3","tuples",",","otherwise","the","bounds","for","the","requested","dimension","."]
code: def get_scene_bounds(self, dim=None):
      """Get the total bounds based on the visuals present in the scene
  
      Parameters
      ----------
      dim : int | None
          Dimension to return.
  
      Returns
      -------
      bounds : list | tuple
          If ``dim is None``, Returns a list of 3 tuples, otherwise
          the bounds for the requested dimension.
      """
      # todo: handle sub-children
      # todo: handle transformations
      # Init
      bounds = [(np.inf, -np.inf), (np.inf, -np.inf), (np.inf, -np.inf)]
      # Get bounds of all children
      for ob in self.scene.children:
          if hasattr(ob, "bounds"):
              for axis in (0, 1, 2):
                  if (dim is not None) and dim != axis:
                      continue
                  b = ob.bounds(axis)
                  if b is not None:
                      b = min(b), max(b)  # Ensure correct order
                      bounds[axis] = (
                          min(bounds[axis][0], b[0]),
                          max(bounds[axis][1], b[1]),
                      )
      # Set defaults
      for axis in (0, 1, 2):
          if any(np.isinf(bounds[axis])):
              bounds[axis] = -1, 1
  
      if dim is not None:
          return bounds[dim]
      else:
          return bounds
  
file_path: vispy/vispy/scene/widgets/viewbox.py
imports: from __future__ import division
  from typing import Union
  import numpy
  from .widget import Widget
  from ..subscene import SubScene
  from ..cameras import make_camera, BaseCamera
  from ...visuals.filters import Clipper
label_desc: Use image node_id 5 for calling the ViewBox obj's underlying member method code with example usage: obj.get_scene_bounds(dim) and returns: bounds, bounds