We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3ab0ba0 + 48e5bb1 commit 091776dCopy full SHA for 091776d
lib/matplotlib/backends/backend_qt4.py
@@ -1,6 +1,7 @@
1
from __future__ import division, print_function
2
import math
3
import os
4
+import re
5
import signal
6
import sys
7
@@ -53,6 +54,13 @@ def _create_qApp():
53
54
global qApp
55
app = QtGui.QApplication.instance()
56
if app is None:
57
+
58
+ # check for DISPLAY env variable on X11 build of Qt
59
+ if hasattr(QtGui, "QX11Info"):
60
+ display = os.environ.get('DISPLAY')
61
+ if display is None or not re.search(':\d', display):
62
+ raise RuntimeError('Invalid DISPLAY variable')
63
64
qApp = QtGui.QApplication( [" "] )
65
QtCore.QObject.connect( qApp, QtCore.SIGNAL( "lastWindowClosed()" ),
66
qApp, QtCore.SLOT( "quit()" ) )
0 commit comments