def __init__(self, parent, uifilepath): QDialog.__init__(self, parent) # load ui file self.ui = loadUi(uifilepath, self) # this is for PySide only # create a layout, add the loaded ui # this is to make sure the widget doesn't # get garbaged collected self.centralLayout = QGridLayout(self) self.centralLayout.setContentsMargins(9, 9, 9, 9) self.centralLayout.addWidget(self.ui) # since PySide doesn't load the ui like PyQt # lets get some properties from the ui file that are still relevant... # the size of the dialog set in QtDesigner self.resize(self.ui.size()) # the window title set in QtDesigner self.setWindowTitle(self.ui.windowTitle()) # connect to the createCube function self.ui.uiCreateCube.clicked.connect(self.createCube)