Skip to content

Commit

Permalink
Close all spawned matplotlib plots when exiting main window
Browse files Browse the repository at this point in the history
Re #84
  • Loading branch information
DanNixon committed Sep 21, 2017
1 parent e68c5d9 commit 233fa09
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mantidimaging/gui/main_window/mw_view.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import absolute_import, division, print_function

import matplotlib

from logging import getLogger
from PyQt5 import Qt, QtCore
from PyQt5 import Qt, QtCore, QtWidgets

from mantidimaging.core.algorithms import gui_compile_ui
Expand Down Expand Up @@ -104,3 +105,12 @@ def show_error_dialog(self, msg=""):
:param msg: Error message string
"""
QtWidgets.QMessageBox.critical(self, "Error", msg)

def closeEvent(self, event):
"""
Close all matplotlib PyPlot windows when exiting.
:param event: Unused
"""
getLogger(__name__).debug("Closing all PyPlot windows")
matplotlib.pyplot.close("all")

0 comments on commit 233fa09

Please sign in to comment.