diff --git a/PIL/ImageQt.py b/PIL/ImageQt.py index 88df3e564..fd662c894 100644 --- a/PIL/ImageQt.py +++ b/PIL/ImageQt.py @@ -18,12 +18,15 @@ from PIL import Image from PIL._util import isPath +import sys -try: +if 'PyQt4.QtGui' not in sys.modules: + try: from PyQt5.QtGui import QImage, qRgba -except: + except: from PyQt4.QtGui import QImage, qRgba - +else: #PyQt4 is used + from PyQt4.QtGui import QImage, qRgba ## # (Internal) Turns an RGB color into a Qt compatible color integer.