class_docstr: Representation of the vispy application
  
  This wraps a native GUI application instance. Vispy has a default
  instance of this class that can be created/obtained via
  `vispy.app.use_app()`.
  
  Parameters
  ----------
  backend_name : str | None
      The name of the backend application to use. If not specified,
      Vispy tries to select a backend automatically. See ``vispy.use()``
      for details.
  
  Notes
  -----
  Upon creating an Application object, a backend is selected, but the
  native backend application object is only created when `create()`
  is called or `native` is used. The Canvas and Timer do this
  automatically.
class_docstr_tok: ["Representation","of","the","vispy","application","This","wraps","a","native","GUI","application","instance",".","Vispy","has","a","default","instance","of","this","class","that","can","be","created\/obtained","via","`","vispy.app.use_app","(",")","`",".","Parameters","--","--","--","--","--","backend_name",":","str","|","None","The","name","of","the","backend","application","to","use",".","If","not","specified",",","Vispy","tries","to","select","a","backend","automatically",".","See","``","vispy.use","(",")","``","for","details",".","Notes","--","--","-","Upon","creating","an","Application","object",",","a","backend","is","selected",",","but","the","native","backend","application","object","is","only","created","when","`","create","(",")","`","is","called","or","`","native","`","is","used",".","The","Canvas","and","Timer","do","this","automatically","."]
docstr: Select a backend by name. See class docstring for details.
docstr_tok: ["Select","a","backend","by","name",".","See","class","docstring","for","details","."]
code: def _use(self, backend_name=None):
      """Select a backend by name. See class docstring for details."""
      # See if we're in a specific testing mode, if so DONT check to see
      # if it's a valid backend. If it isn't, it's a good thing we
      # get an error later because we should have decorated our test
      # with requires_application()
      test_name = os.getenv("_VISPY_TESTING_APP", None)
  
      # Check whether the given name is valid
      if backend_name is not None:
          if backend_name.lower() == "default":
              backend_name = (
                  None  # Explicitly use default, avoid using test
              )
          elif backend_name.lower() not in BACKENDMAP:
              raise ValueError(
                  "backend_name must be one of %s or None, not "
                  "%r" % (BACKEND_NAMES, backend_name)
              )
      elif test_name is not None:
          backend_name = test_name.lower()
          assert backend_name in BACKENDMAP
      elif self.is_notebook():
          backend_name = "jupyter_rfb"
  
      # Should we try and load any backend, or just this specific one?
      try_others = backend_name is None
  
      # Get backends to try ...
      imported_toolkits = (
          []
      )  # Backends for which the native lib is imported
      backends_to_try = []
      if not try_others:
          # We should never hit this, since we check above
          assert backend_name.lower() in BACKENDMAP.keys()
          # Add it
          backends_to_try.append(backend_name.lower())
      else:
          # See if a backend is loaded
          for name, module_name, native_module_name in CORE_BACKENDS:
              if (
                  native_module_name
                  and native_module_name in sys.modules
              ):
                  imported_toolkits.append(name.lower())
                  backends_to_try.append(name.lower())
          # See if a default is given
          default_backend = config["default_backend"].lower()
          if default_backend.lower() in BACKENDMAP.keys():
              if default_backend not in backends_to_try:
                  backends_to_try.append(default_backend)
          # After this, try each one
          for name, module_name, native_module_name in CORE_BACKENDS:
              name = name.lower()
              if name not in backends_to_try:
                  backends_to_try.append(name)
  
      # Now try each one
      for key in backends_to_try:
          name, module_name, native_module_name = BACKENDMAP[key]
          TRIED_BACKENDS.append(name)
          mod_name = "backends." + module_name
          __import__(mod_name, globals(), level=1)
          mod = getattr(backends, module_name)
          if not mod.available:
              msg = 'Could not import backend "%s":\n%s' % (
                  name,
                  str(mod.why_not),
              )
              if not try_others:
                  # Fail if user wanted to use a specific backend
                  raise RuntimeError(msg)
              elif key in imported_toolkits:
                  # Warn if were unable to use an already imported toolkit
                  msg = (
                      "Although %s is already imported, the %s backend "
                      'could not\nbe used ("%s"). \nNote that running '
                      "multiple GUI toolkits simultaneously can cause "
                      "side effects."
                      % (native_module_name, name, str(mod.why_not))
                  )
                  logger.warning(msg)
              elif backend_name is not None:
                  # Inform only if one isn't available
                  logger.warning(msg)
          else:
              # Success!
              self._backend_module = mod
              logger.info("Selected backend %s" % module_name)
              break
      else:
          raise RuntimeError(
              "Could not import any of the backends. "
              "You need to install any of %s. We recommend "
              "PyQt" % [b[0] for b in CORE_BACKENDS]
          )
  
      # Store classes for app backend and canvas backend
      self._backend = self.backend_module.ApplicationBackend()
  
imports: from __future__ import division
  import builtins
  import os
  import sys
  from .None import backends
  from .backends import CORE_BACKENDS, BACKEND_NAMES, BACKENDMAP, TRIED_BACKENDS
  from ..None import config
  from .base import BaseApplicationBackend
  from ._detect_eventloop import _get_running_interactive_framework
  from ..util import logger
label_desc: Use image node_id 14 for calling the Application obj's underlying member method code with example usage: obj._use(backend_name) without return types