Destroy manager *num* -- either a manager instance or a manager number. In the interactive backends, this is bound to the window "destroy" and "delete" events. It is recommended to pass a manager instance, to avoid confusion when two managers share the same
(cls, num)
| 43 | |
| 44 | @classmethod |
| 45 | def destroy(cls, num): |
| 46 | """ |
| 47 | Destroy manager *num* -- either a manager instance or a manager number. |
| 48 | |
| 49 | In the interactive backends, this is bound to the window "destroy" and |
| 50 | "delete" events. |
| 51 | |
| 52 | It is recommended to pass a manager instance, to avoid confusion when |
| 53 | two managers share the same number. |
| 54 | """ |
| 55 | if all(hasattr(num, attr) for attr in ["num", "destroy"]): |
| 56 | # num is a manager-like instance (not necessarily a |
| 57 | # FigureManagerBase subclass) |
| 58 | manager = num |
| 59 | if cls.figs.get(manager.num) is manager: |
| 60 | cls.figs.pop(manager.num) |
| 61 | else: |
| 62 | try: |
| 63 | manager = cls.figs.pop(num) |
| 64 | except KeyError: |
| 65 | return |
| 66 | if hasattr(manager, "_cidgcf"): |
| 67 | manager.canvas.mpl_disconnect(manager._cidgcf) |
| 68 | manager.destroy() |
| 69 | |
| 70 | @classmethod |
| 71 | def destroy_fig(cls, fig): |
no test coverage detected