PyQt4和PyQt5版本差异。
PyQt4采用:QVBoxLayout的setMargin方法
PyQt5采用:QVBoxLayout的setContentsMargins方法
错误提示: return QtGui.QApplication.translate(context, text, disambig)
AttributeError: module ‘PyQt5.QtGui’ has no attribute ‘QApplication’
修改:return QApplication.translate(context, text, disambig)
原因:PyQt4和PyQt5版本差异。
错误提示:NameError: name ‘unicode’ is not defined
修改:Python2 的unicode 函数在 Python3 中被命名为 str。在 Python3 中使用 ·str 来代替 Python2 中的 unicode.
原因:There is no such name in Python 3, no. You are trying to run Python 2 code in Python 3. In Python 3, unicode has been renamed to str.