PyQt: give parent when creating a widget?
<p>Let's assume I want to create a dialog box, a child of my main program:</p>

<pre><code>from PyQt4 import QtGui, QtCore

class WizardJournal(QtGui.QDialog):

    def __init__(self, parent):

        super(WizardJournal, self).__init__(parent)

        self.parent = parent

        self.initUI()


    def initUI(self):

        self.parent.wizard = QtGui.QWidget()

        self.ok_button = QtGui.QPushButton("OK", self)

        self.vbox_global = QtGui.QVBoxLayout(self)

        self.vbox_global.addWidget(self.ok_button)

        self.paret.wizard.setLayout(self.vbox_global)
        self.parent.wizard.show()


if __name__ == '__main__':

    app = QtGui.QApplication(sys.argv)
    parent = QtGui.QWidget()
    obj = WizardJournal(parent)
    sys.exit(app.exec_())
</code></pre>

<p>This dialog box will be opened and closed by my main program. What is better regarding memory consumption:</p>

<ul>
<li><code>self.ok_button = QtGui.QPushButton("OK", self)</code></li>
<li><code>self.ok_button = QtGui.QPushButton("OK")</code></li>
</ul>

<p>Basically, I would like to know if I should mention the parent widget when I create a widget. When I will close this dialog box, will the OK button be released from memory if I didn't mention the parent widget when I created it ?</p>