On Wed, 20 Aug 2014 00:11:24 +0200, Alex Murray wrote: > <html><head></head><body><div style="font-family: Verdana;font-size: > 12.0px;"><div>Hi,</div> > > <div> </div> > > <div>I've discovered some very strange behaviour when trying to > delete a QWidget from a QGridLayout. The following code demonstrates > this behaviour:</div> > > <div> </div> > > <div>>>> from PyQt4 import QtGui</div> > > <div>>>> import sys</div> > > <div>>>> app = QtGui.QApplication(sys.argv)</div> > > <div>>>> grid_layout = QtGui.QGridLayout()<br/> > >>> grid_layout.addWidget(QtGui.QWidget())<br/> > >>> item = self.grid_layout.takeAt(0)<br/> > >>> item.deleteLater()</div> > > <div>Traceback (most recent call last):<br/> > File "<stdin>", line 1, in <module><br/> > AttributeError: 'QWidgetItem' object has no attribute > 'deleteLater'</div> > > <div> </div> > > <div>This makes no sense to me whatsoever. Firstly, why is it returning > a QWidgetItem when I inserted a QWidget to begin with? Secondly, every > Qt object derives from QObject, and deleteLater() is a method of > QObject, so that method should exist. Additional info:</div> > > <div> > <div>Python 2.7.6 (default, Mar 22 2014, 22:59:56)<br/> > [GCC 4.8.2] on linux2</div> > > <div>using PyQt4</div> > </div></div></body></html>
Please do not post in HTML it makes everything an unreadable mess (I have left you original post above so you can see what I mean.) -- <dark> "Yes, your honour, I have RSA encryption code tattood on my penis. Shall I show the jury?" -- https://mail.python.org/mailman/listinfo/python-list