QMessageBox对话框
infoBox = QMessageBox() infoBox.setIcon(QMessageBox.Question) infoBox.setWindowTitle("初始化失败") infoBox.setText("读取info.inf失败,因为没有找到此文件\n请将此文件放置到同级文件目录!\n 是否不加载配置继续操作?") infoBox.setStandardButtons(QMessageBox.Ok|QMessageBox.No) infoBox.exec_() if infoBox.clickedButton().text() == "OK": print('YES pressed') elif infoBox.clickedButton().text() == "&No": print('NO pressed')