From d120f4769d697c9943e4170c75dae291040db8a4 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sat, 25 Feb 2017 13:36:23 -0800 Subject: [PATCH] Fix check for DISPLAY on PyQt5. This check avoids a fatal error when the DISPLAY environment variable is not set using PyQt5, e.g. ``` MPLBACKEND=qt5agg DISPLAY= python -c 'from pylab import *; plot(); show()' ``` (The previous check only worked on PyQt4.) --- lib/matplotlib/backends/backend_qt5.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_qt5.py b/lib/matplotlib/backends/backend_qt5.py index 0f23b12462a2..71fe6ef61de2 100644 --- a/lib/matplotlib/backends/backend_qt5.py +++ b/lib/matplotlib/backends/backend_qt5.py @@ -130,7 +130,15 @@ def _create_qApp(): app = QtWidgets.QApplication.instance() if app is None: # check for DISPLAY env variable on X11 build of Qt - if hasattr(QtGui, "QX11Info"): + if is_pyqt5(): + try: + from PyQt5 import QtX11Extras + is_x11_build = True + except ImportError: + is_x11_build = False + else: + is_x11_build = hasattr(QtGui, "QX11Info") + if is_x11_build: display = os.environ.get('DISPLAY') if display is None or not re.search(r':\d', display): raise RuntimeError('Invalid DISPLAY variable') pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy