I've just moved from PyQt4 to 5 and I'm having an issue with QtGui. I installed using the 32bit windows installer, not my own build.
when I do:
from PyQt5 import QtGui
I get
class MainWindow(QtGui.QMainWindow, UI.MainUI.Ui_MainWindow):
AttributeError: 'module' object has no attribute 'QMainWindow'
so I tried
from PyQt5.QtWidgets import QtGui
Which results in:
ImportError: cannot import name QtGui
then I tried to change the sys.path according to Pyinstaller: ImportError: cannot import name QtGui work around but it still gives me the same
ImportError: cannot import name QtGui
Update: It looks like I do in fact import QtGui because when I go in IDLE and try it, it still autocompletes QMovie and a whole bunch of other attributes. Is there any reason QMainWindow just wouldn't be in there? (It's not, neither is QDialog and they seem important)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…