Thanks Alexandru,
I will try it the way you suggest.
Cheers,
frank
On 27/03/17 9:59 PM, Alexandru Croitor wrote:
Hi,
I'm going to assume this is with PyQt.
Aside from what Thiago already mentioned, you could try to connect a method
declared outside of the class scope.
So something like:
def myDestructor(obj):
pass
class MyClass(object):
def __init__(self):
self.destroyed.connect(myDestructor)
Also do take into account that a Python object's destructor aka __del__ method
might not be executed if the object is part of a cycle, due to the garbage
collector not knowing the order in which destructors should be called.
I believe starting with Python 3.4, finalizers are always called.
On 27 Mar 2017, at 03:52, Frank Rueter | OHUfx <[email protected]> wrote:
Hi,
I'm pretty sure I'm misinterpreting how this should work so maybe you guys can
help:
I have a QObject which I would like to run a simple clean up job just before
it's destroyed.
I thought I could simply do this in it's constructor:
self.destroyed.connect(self.__cleanUp)
Then have self.__cleanUp() to the work.
However, a simple print statement inside self.__cleanUp() shows that it's never
run.
What am I missing?
Thanks,
frank
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest