PyQt: RuntimeError: wrapped C/C++ object has been deleted

This answer to this question is as found here:
Python PySide (Internal c++ Object Already Deleted)

Apparently, assigning one widget to QMainWindow using setCentralWidget and then assigning another widget with setCentralWidget will cause the underlying c++ QWidget to be deleted, even though I have an object that maintains reference to it.

Note: QMainWindow takes ownership of the widget pointer and deletes it at the appropriate time.

Leave a Comment