Skip to content

Commit b051630

Browse files
committed
Fix import of qt backend for matplotlib without qt4 support
1 parent e9c1f53 commit b051630

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

viscm/gui.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@
1616
# Do this first before any other matplotlib imports, to force matplotlib to
1717
# use a Qt backend
1818
from matplotlib.backends.qt_compat import QtWidgets, QtCore, QtGui, _getSaveFileName
19-
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas4
20-
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas5
2119

22-
def FigureCanvas(fig):
23-
try:
24-
return FigureCanvas5(fig)
25-
except Exception:
26-
return FigureCanvas4(fig)
20+
try:
21+
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
22+
except Exception:
23+
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
2724

2825
import matplotlib
2926
import matplotlib.pyplot as plt

0 commit comments

Comments
 (0)