记录一下:
def show_child(self): child_window = QProgressBarExample() child_window.show()
原因是:child_window是个临时变量,所在的方法执行完毕后就destroyed了,如果要想不被销毁,则将child_window变成本类中的变量即可,即将child_window变成self.child_window即可,或者将child_window放到本类中的widget中也可
def show_child(self): self.child_window = Example() self.child_window.show()