8000 Fix checking of X11 builds with PySide2. · matplotlib/matplotlib@fdf796e · GitHub
[go: up one dir, main page]

Skip to content

Commit fdf796e

Browse files
committed
Fix checking of X11 builds with PySide2.
Import QtX11Extras from PySide2 instead of PyQt5 if we're otherwise already using PySide2.
1 parent bb7f9b9 commit fdf796e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import functools
2+
import importlib
23
import os
34
import re
45
import signal
@@ -108,7 +109,9 @@ def _create_qApp():
108109
# check for DISPLAY env variable on X11 build of Qt
109110
if is_pyqt5():
110111
try:
111-
from PyQt5 import QtX11Extras
112+
importlib.import_module(
113+
# i.e. PyQt5.QtX11Extras or PySide2.QtX11Extras.
114+
f"{QtWidgets.__package__}.QtX11Extras")
112115
is_x11_build = True
113116
except ImportError:
114117
is_x11_build = False

0 commit comments

Comments
 (0)
0