<div><div style="color: rgb(0, 0, 0); font-family: arial; font-size: 14px;"><br></div><div><div>For </div><div>self.widget = QtGui.QWidget(self)</div><div>Which is responsible for destroy <span style="line-height: 23.7999992370605px;">self.widget</span><span style="line-height: 1.7;"> when application exist ?</span></div><div style="color: rgb(0, 0, 0); font-family: arial; font-size: 14px;"><br></div></div><div style="color: rgb(0, 0, 0); font-family: arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: arial; font-size: 14px;"><br></div></div><!-- jy5ContentSuffix --><div>在2015年04月02 01时13分, "Baz Walter"<bazwal@ftml.net>写道:</div><blockquote id="isReplyContent" style="padding-left:1ex; margin: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>> -------- Forwarded Message --------<br>> Subject: Re:Re: [PyQt] Python has stopped working in PyQt application<br>> Date: Wed, 1 Apr 2015 14:39:05 +0800 (CST)<br>> From: redstone-cold <<a href="mailto:redstone-cold@163.com">redstone-cold@163.com</a>><br>> To: Baz Walter <<a href="mailto:bazwal@ftml.net">bazwal@ftml.net</a>><br>><br>> Since Qt ensure that objects get deleted in the right order, so is it<br>> better to let the parent argument not be None, thus causes self to be<br>> owned by Qt instead of PyQt?<br>><br><br>There are two parts to every object in PyQt: a Python part and a Qt <br>part. If you create a widget like this:<br><br>     self.widget = QtGui.QWidget(self)<br><br>there will be two references - one on the Python side, and one on the Qt <br>side. If all your widgets are connected together with parent/child <br>links, then it makes it easier for Qt to automatically delete all the Qt <br>parts (I suppose the children are deleted from the bottom up).<br><br>But if most of the deletion is managed from the Python side, it will <br>sometimes be less reliable, because the correct order of deletion cannot <br>always be guaranteed (e.g. when the interpreter is closing down).<br>_______________________________________________<br>PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br></blockquote><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>