GUI编程调试可用运行闪退的问题解决方案

 问题:调试可以正常调试,运行不能正常运行

class Oder_Main(QtWidgets.QWidget,Ui_Form):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        ......
    def HELLO(self):
        X=get_goods()
        X.show()
class get_goods(QtWidgets.QWidget,Ui_Form1):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        ......

解决方案:X=get_goods()和X.show改成self.X=get_goods()self.X.show()

总结:在GUI编程中如果上面的Oder_Main要想继承下面的get_goods 必须要家self

你可能感兴趣的:(ui,python)