Call QCoreApplication.processEvents() after writing to Python console. Fixes #8343.

This enables incremental output from Python code run in the Python console - currently the user has to wait until the function terminates before seeing any output, so he or she can't see progress indications, etc.