import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QMessageBox
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
def window():
app = QApplication(sys.argv)
win = QWidget()
win.setWindowTitle("Тест на дебилизм")
win.show()
showDialog()
sys.exit(app.exec_())
def showDialog():
msgBox = QMessageBox()
msgBox.setIcon(QMessageBox.Information)
msgBox.setText("Ты дебил?")
msgBox.setWindowTitle("Сообщение")
msgBox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
returnValue = msgBox.exec()
if returnValue == QMessageBox.Ok:
msgBox2 = QMessageBox()
msgBox2.setIcon(QMessageBox.Information)
msgBox2.setText("Я считаю себя дебилом")
msgBox2.setWindowTitle("Сообщение")
msgBox2.setStandardButtons(QMessageBox.Ok)
msgBox2.exec()
if returnValue == QMessageBox.Cancel:
msgBox3 = QMessageBox()
msgBox3.setIcon(QMessageBox.Information)
msgBox3.setText("Я не считаю себя дебилом")
msgBox3.setWindowTitle("Сообщение")
msgBox3.setStandardButtons(QMessageBox.Ok)
msgBox3.exec()
if __name__ == '__main__':
window()
|