def activate_matplotlib(enable_gui_function):
    """Set interactive to True for interactive backends.
    enable_gui_function - Function which enables gui, should be run in the main thread.
    """
    matplotlib = sys.modules['matplotlib']
    gui, backend = find_gui_and_backend()
    is_interactive = is_interactive_backend(backend)
    if is_interactive:
        enable_gui_function(gui)
        if not matplotlib.is_interactive():
            sys.stdout.write("Backend %s is interactive backend. Turning interactive mode on.\n" % backend)
        matplotlib.interactive(True)
    else:
        if matplotlib.is_interactive():
            sys.stdout.write("Backend %s is non-interactive backend. Turning interactive mode off.\n" % backend)
        matplotlib.interactive(False)
    patch_use(enable_gui_function)
    patch_is_interactive()
def activate_matplotlib ( enable_gui_function ) : matplotlib = sys . modules [ 'matplotlib' ] gui , backend = find_gui_and_backend ( ) is_interactive = is_interactive_backend ( backend ) if is_interactive : enable_gui_function ( gui ) if not matplotlib . is_interactive ( ) : sys . stdout . write ( "Backend %s is interactive backend. Turning interactive mode on.\n" % backend ) matplotlib . interactive ( True ) else : if matplotlib . is_interactive ( ) : sys . stdout . write ( "Backend %s is non-interactive backend. Turning interactive mode off.\n" % backend ) matplotlib . interactive ( False ) patch_use ( enable_gui_function ) patch_is_interactive ( )
Set interactive to True for interactive backends.
    enable_gui_function - Function which enables gui, should be run in the main thread.