A bit of debugging inside a PyQt app

A short article, a reminder in fact.

Once again I have to use the Python built-in debugger. This time inside a PyQt application. Yet it is not just about using import pdb; pdb.set_trace(). Indeed if I only do that I am a bit annoyed by the Qt event loop :

With these two additional lines, problem is solved:

from PyQt5.QtCore import pyqtRemoveInputHook
pyqtRemoveInputHook()
import pdb; pdb.set_trace()