简体   繁体   English

PyQT:找不到 QDialog

[英]PyQT: Cannot find QDialog

I have an error message in the line class:我在 class 行中有一条错误消息:

    MESRIDialog(QtGui.QDialog, FORM_CLASS): 
AttributeError: module 'PyQt5.QtGui' has no attribute 'QDialog'.

This is my code:这是我的代码:

import os

from PyQt5 import QtGui, uic

#from PyQt5 import QtWidgets
from PyQt5.QtWidgets import (QApplication,QWidget,QDialog)

FORM_CLASS, _ = uic.loadUiType(os.path.join(
    os.path.dirname(__file__), 'MESRI_dialog_base.ui'))


class MESRIDialog(QtGui.QDialog, FORM_CLASS):
    def __init__(self, parent=None):
        """Constructor."""
        super(MESRIDialog, self).__init__(parent)
        # Set up the user interface from Designer.
        # After setupUI you can access any designer object by doing
        # self.<objectname>, and you can use autoconnect slots - see
        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
        # #widgets-and-dialogs-with-auto-connect
        self.setupUi(self)

I have an error message in the line class:我在 class 行中有一条错误消息:

    MESRIDialog(QtGui.QDialog, FORM_CLASS): 
AttributeError: module 'PyQt5.QtGui' has no attribute 'QDialog'.

This is my code:这是我的代码:

import os

from PyQt5 import QtGui, uic

#from PyQt5 import QtWidgets
from PyQt5.QtWidgets import (QApplication,QWidget,QDialog)

FORM_CLASS, _ = uic.loadUiType(os.path.join(
    os.path.dirname(__file__), 'MESRI_dialog_base.ui'))


class MESRIDialog(QtGui.QDialog, FORM_CLASS):
    def __init__(self, parent=None):
        """Constructor."""
        super(MESRIDialog, self).__init__(parent)
        # Set up the user interface from Designer.
        # After setupUI you can access any designer object by doing
        # self.<objectname>, and you can use autoconnect slots - see
        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
        # #widgets-and-dialogs-with-auto-connect
        self.setupUi(self)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM