Check if backend is interactive
(backend)
| 82 | |
| 83 | |
| 84 | def is_interactive_backend(backend): |
| 85 | """Check if backend is interactive""" |
| 86 | matplotlib = sys.modules["matplotlib"] |
| 87 | new_api_version = (3, 9) |
| 88 | installed_version = (_get_major_version(matplotlib), _get_minor_version(matplotlib)) |
| 89 | |
| 90 | if installed_version >= new_api_version: |
| 91 | interactive_bk = matplotlib.backends.backend_registry.list_builtin(matplotlib.backends.BackendFilter.INTERACTIVE) |
| 92 | non_interactive_bk = matplotlib.backends.backend_registry.list_builtin(matplotlib.backends.BackendFilter.NON_INTERACTIVE) |
| 93 | else: |
| 94 | from matplotlib.rcsetup import interactive_bk, non_interactive_bk # @UnresolvedImport |
| 95 | |
| 96 | if backend in interactive_bk: |
| 97 | return True |
| 98 | elif backend in non_interactive_bk: |
| 99 | return False |
| 100 | else: |
| 101 | return matplotlib.is_interactive() |
| 102 | |
| 103 | |
| 104 | def patch_use(enable_gui_function): |
no test coverage detected