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: Enter the native GUI event loop.
  
  Parameters
  ----------
  allow_interactive : bool
      Is the application allowed to handle interactive mode for console
      terminals?  By default, typing ``python -i main.py`` results in
      an interactive shell that also regularly calls the VisPy event
      loop.  In this specific case, the run() function will terminate
      immediately and rely on the interpreter's input loop to be run
      after script execution.
docstr_tok: ["Enter","the","native","GUI","event","loop",".","Parameters","--","--","--","--","--","allow_interactive",":","bool","Is","the","application","allowed","to","handle","interactive","mode","for","console","terminals","?","By","default",",","typing","``","python","-i","main.py","``","results","in","an","interactive","shell","that","also","regularly","calls","the","VisPy","event","loop",".","In","this","specific","case",",","the","run","(",")","function","will","terminate","immediately","and","rely","on","the","interpreter","'s","input","loop","to","be","run","after","script","execution","."]
code: def run(self, allow_interactive=True):
      """Enter the native GUI event loop.
  
      Parameters
      ----------
      allow_interactive : bool
          Is the application allowed to handle interactive mode for console
          terminals?  By default, typing ``python -i main.py`` results in
          an interactive shell that also regularly calls the VisPy event
          loop.  In this specific case, the run() function will terminate
          immediately and rely on the interpreter's input loop to be run
          after script execution.
      """
      if os.getenv("_VISPY_RUNNING_GALLERY_EXAMPLES"):
          # Custom sphinx-gallery scraper in doc/conf.py will handle
          # rendering/running the application. To make example scripts look
          # like what a user actually has to run to view the window, we let
          # them run "app.run()" but immediately return here.
          # Without this the application would block until someone closed the
          # window that opens.
          return 0
      elif not allow_interactive or not self.is_interactive():
          return self._backend._vispy_run()
  
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 10 for calling the Application obj's underlying member method code with example usage: obj.run(allow_interactive) and returns: int, self