Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1cbce7d

Browse files
author
Julien Schueller
committed
Check for a X11 build of Qt
1 parent 9bed016 commit 1cbce7d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/matplotlib/backends/backend_qt4.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
from qt4_compat import QtCore, QtGui, _getSaveFileName, __version__
2525

26-
import subprocess
27-
2826
backend_version = __version__
2927
def fn_name(): return sys._getframe(1).f_code.co_name
3028

@@ -56,10 +54,10 @@ def _create_qApp():
5654
app = QtGui.QApplication.instance()
5755
if app is None:
5856

59-
# check for DISPLAY env variable
60-
if sys.platform.startswith('linux'):
57+
# check for DISPLAY env variable on X11 build of Qt
58+
if hasattr(QtGui, "QX11Info"):
6159
display = os.environ.get('DISPLAY')
62-
if (display is None) or (not ':' in display.strip()):
60+
if (display is None) or (not ':' in display):
6361
raise RuntimeError('Invalid DISPLAY variable')
6462

6563
qApp = QtGui.QApplication( [" "] )

0 commit comments

Comments
 (0)