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

后端 未结 4 1729
醉酒成梦
醉酒成梦 2020-12-01 18:25

If I run this code:

    #!/usr/local/bin/    python3

import sys 
from PyQt4.QtCore import *
from PyQt4.QtGui import *


class Window(QMainWindow):

    def          


        
4条回答
  •  情话喂你
    2020-12-01 18:54

    In another case, the solution was to add all child objects to a detached layout first, and adding the layout to the parent layout as the last step. That is:

        l = QGridLayout()
        l.addWidget(QLabel("child1"), 0, 0)
        l.addWidget(QLabel("child2"), 0, 1)
        ...
        parentLayout.addLayout(l)
    

提交回复
热议问题