title: How to place custom image onto QMessageBox
body: <p><a href="https://i.stack.imgur.com/6tjbv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6tjbv.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>Clicking "Submit" button brings a <code>QMessageBox</code> with three response buttons. 'Critical', 'Information', 'Question', 'Warning' boxes each have their icon. Is there a way to customize the icon on QMessageBox?</p>
  
  <pre><code>from PyQt4 import QtGui, QtCore
  import sys
  app = QtGui.QApplication([])
  
  class Dialog(QtGui.QDialog):
      def __init__(self, parent=None):
          super(Dialog, self).__init__(parent)
  
          self.resize(300, 100)
          self.setLayout(QtGui.QVBoxLayout())
  
          button = QtGui.QPushButton('Submit')
          button.clicked.connect(self.onclick)
          self.layout().addWidget(button)
  
      def onclick(self):
          self.close()
          messagebox = QtGui.QMessageBox(QtGui.QMessageBox.Warning, "Title text", "body text", buttons = QtGui.QMessageBox.Discard | QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ok, parent=self)
          messagebox.setDefaultButton(QtGui.QMessageBox.Cancel)
          exe = messagebox.exec_()
          print 'messagebox.exec_(): %s'%exe    
  
  
  
  dialog = Dialog()
  dialog.show()     
  app.exec_()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/mqTeu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mqTeu.png" alt="enter image description here"></a></p>