title: Display stderr in a pyqt QMessageBox
body: <p>I want to capture stderr output from my PyQt script and display it in a QMessageBox.  I found these posts and tried them, but none really worked for me:</p>
  
  <p><a href="https://stackoverflow.com/questions/24017143/display-python-console-messages-in-qmessagebox">Display python console messages in QMessageBox</a></p>
  
  <p><a href="https://stackoverflow.com/questions/21071448/redirecting-stdout-and-stderr-to-a-pyqt4-qtextedit-from-a-secondary-thread">Redirecting stdout and stderr to a PyQt4 QTextEdit from a secondary thread</a></p>
  
  <p><a href="https://stackoverflow.com/questions/15637768/pyqt-how-to-capture-output-of-pythons-interpreter-and-display-it-in-qedittext/15657432#15657432">PYQT: How to capture output of python&#39;s interpreter and display it in QEditText?</a></p>
  
  <p>I was having a couple problems.  First, a single error seems to be sent as a series of separate stderr messages (at least in Python 3.4).  This caused multiple message boxes to be opened using the approaches I found, and required using <code>.show()</code> instead of <code>.exec()</code> and accumulating the separate messages into one.  </p>
  
  <p>Also, if a second error occurred the text from the first error remained in the new message box, even though the first message box had been closed.  I tried calling <code>.destroy()</code> and using <code>Qt.WA_DeleteOnClose</code>, but the first message box wouldn't actually go away.  So I ended up simply deleting the text from the persistent message box.  </p>
  
  <p>Finding a clean way to field both 'close window' and 'OK' events took some experimentation too.</p>