message box pyqt code example
Example 1: pyqt5 message box
msg=QMessageBox()
msg.setIcon(QMessageBox.Information)
msg.setText("This is a message box")
msg.setInformativeText("This is additional information")
msg.setWindowTitle("MessageBox demo")
msg.setDetailedText("The details are as follows:")
msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
msg.buttonClicked.connect(myfunc)
return_value =msg.exec_()
print("value of pressed message box button:", str(return_value))
Example 2: pyqt message box set information text
msg.setInformativeText("This is additional information")