[PyQt] Getting rid of an object

David Klasinc bigwhale at lubica.net
Sat Jun 7 18:01:01 BST 2008


Greetings,

I am facing a rather annoying problem since I have no idea how to get 
rid of a dialog that I created.

For example, in an instance of QMainWindow I opened another dialog with

  self.dialogNew = newDialog (self)
  self.dialogNew.show ()

newDialog is a subclassed QDialog with UI created in Qt Designer.


Now, how do I get rid of that dialog and when will its destructor get 
called?

I implemented __del__ method just too see when it gets called, but it 
turns out that I can execute

del self.dialogNew

and still nothing happens.

My probles goes deeper than this, since I have one QObject class that I 
used to implement timer. Now, I would want to delete certain instance of 
this class because I don't need it. And since del doesn't do anything, 
my timer never stops.

If anyone can shed some light on this, I'd be very happy.

rgrds,
David


More information about the PyQt mailing list