pyqt4

QMessageBox

Introduction#

QMessageBox is the simplest way to give (or ask) an information to (or from) the user. It’s a modal dialog, inheriting the QDialog class. It also has four convenience static functions: information, question, warning and critical.

Basic usage: Hello World

app = QApplication( sys.argv )
box = QMessageBox()

# Window Title
box.setWindowTitle( "Hello World." )

# Icon: Information, Warning, Question, Critical
box.setIcon( QMessageBox.Information )

# Short version of the information
box.setText( "Hello World!" )

# Informative text
box.setInformativeText( "Hello World! We are using Qt to display this beautiful dialog to you." )

# Show the messagebox as a modal dialog
box.exec_()

return 0

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow