[PySide] Is dual inheritance clearer?

Algis Kabaila akabaila at pcug.org.au
Thu Apr 4 07:02:06 CEST 2013


Hi,

I believe that PySide (and PyQt for that matter) are widely used for GUI 
design.  There are two main "orderly" ways to start a GUI program, after 
designing it in the Qt Creator: 

(1)
With dual inheritance:
class MainWindow(QMainWindow, Ui_MainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)

(2)
Without dual inheritance:
class MainWindow(QMainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.ui = Ui_MainWindow
        self.ui.setupUi(Ui_MainWindow(),self)

There have been some horror stories about the evils of multiple 
inheritance.  What is the preferred method, (1) or (2)?  

Thank you in anticipation of your response.

Al.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20130404/87971619/attachment.html>


More information about the PySide mailing list