Implements the global singleton app object.


Bases: object

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

backend_namestr | None

The name of the backend application to use. If not specified, Vispy tries to select a backend automatically. See vispy.use() for details.


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.

property backend_module#

The module object that defines the backend.

property backend_name#

The name of the GUI backend that this app wraps.


Create the native application.


Determine if the user requested interactive mode.


Determine if the user is executing in a Jupyter Notebook

property native#

The native GUI application instance.


Process all pending GUI events. If the mainloop is not running, this should be done regularly to keep the visualization interactive and to keep the event system going.


Quit the native GUI event loop.


Called when the application is reused in an interactive session. This allow the backend to do stuff in the client when use_app() is called multiple times by the user. For example, the notebook backends need to inject JavaScript code as soon as use_app() is called.


Enter the native GUI event loop.


Is the application allowed to handle interactive mode for console terminals? By default, typing python -i 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.


Sleep for the given duration in seconds.

This is used to reduce CPU stress when VisPy is run in interactive mode.

duration_sec: float

Time to sleep in seconds