On Thu, Apr 4, 2013 at 8:02 AM, Algis Kabaila <[email protected]> wrote:
> ** > > 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)? > I'd say - that depends on what Ui_MainWindow is, but in general case (2) is better, because: * self.ui defines a namespace to look for methods of UiMW object * explicit is better than implicit -- anatoly t.
_______________________________________________ PySide mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/pyside
