凌的博客

您现在的位置是: 首页 > 学无止境 > python > 

python

PyQt5 强制全部退出

2020-05-04 python 1843
#自己导入需要 相应的 库
class Dialog(QtWidgets.QDialog):
    def closeEvent(self, event):
        
        #清理一些 自己需要关闭的东西
        event.accept()#界面的关闭   但是会有一些时候退出不完全    需要调用 os 的_exit 完全退出
        try:
            os._exit(5) 
        except Exception as e:
            print(e)

测试可用,效果很明显!

文章评论

0条评论