Python PySide (Internal c++ Object Already Deleted)

后端 未结 2 1547
耶瑟儿~
耶瑟儿~ 2021-01-03 22:07

I recently decided to write my first app with Python and PySide. But I have a problem and hope you guys can help.

Python keeps raising exceptions that the \"Internal

2条回答
  •  伪装坚强ぢ
    2021-01-03 22:37

    After some searching and hair pulling, I found the solution. I was showing all the pages by setting them as the central widget, and when reading the QMainWindow documentation I found that my widget basically gets deleted by qt as stated:

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

    So to develop a Multi-Page application rather take a look at QStackedWidget.

提交回复
热议问题