title: Where is the PyQt/PySide event-loop running?
body: <p>If I open a Python interpreter and enter the following lines:</p>
  <pre><code>from PyQt4 import QtGui
  app = QtGui.QApplication([])
  w = QtGui.QLineEdit()
  w.show()
  </code></pre>
  <p>then a text entry widget appears. I can interact with it while I interact with the interpreter. If I had attached any event handlers, they would be called too.</p>
  <p>If I do <code>import time; time.sleep(10)</code>, the Widget becomes unresponsive for 10 seconds.</p>
  <p>If I run <code>app.exec_()</code>, that call blocks until I close the application.</p>
  <p>My question is: what is the point of running <code>app.exec_()</code> if the widget is already responding to events? What is different? Is it just a way of preventing the application from closing while still servicing Qt's event loop (<code>while True: pass</code> would cause the event loop to block, as we understand from doing <code>time.sleep(10)</code>)</p>
  <p>I would also like to understand where Qt has hooked into CPython that allows the interpreter and the GUI to be active. I'm aware that Python 2 (and possibly 3?) has a so-called <code>PyOS_InputHook</code> mechanism, which is called roughly 10 times a second. IPython uses this to run a GUI (with lots of effort to handle GUI events faster than 10 times a second). Is the same thing happening when I instantiate a <code>QApplication</code>? If so, again, what is the point of calling <code>app.exec_()</code></p>