diff --git a/modules/gui/src/python_shell/python_interpreter.cc b/modules/gui/src/python_shell/python_interpreter.cc
index 0f28c0f5a9169a28bbc790959bffffd8bacfd8d7..059d69ce67133bdf2d133847c1d29fdb6181614a 100644
--- a/modules/gui/src/python_shell/python_interpreter.cc
+++ b/modules/gui/src/python_shell/python_interpreter.cc
@@ -34,7 +34,6 @@
 #include <QFile>
 #include <QDebug>
 #include <QFile>
-#include <QApplication>
 #include <QStringList>
 #include <ost/log.hh>
 
diff --git a/modules/gui/src/python_shell/python_shell_widget.cc b/modules/gui/src/python_shell/python_shell_widget.cc
index e41fa8a1e8a8c00eea7f8c7e5fac8f633898be51..2f91995fb4945147957dd6288c8cb8a793da94a0 100644
--- a/modules/gui/src/python_shell/python_shell_widget.cc
+++ b/modules/gui/src/python_shell/python_shell_widget.cc
@@ -464,6 +464,7 @@ void PythonShellWidget::AppendOutput(unsigned int id,const QString& output)
   verticalScrollBar()->triggerAction(QAbstractSlider::SliderToMaximum);
   ensureCursorVisible();
   repaint();
+  QApplication::processEvents();
 }
 
 void PythonShellWidget::AppendError(unsigned int id,const QString& output)
@@ -483,6 +484,7 @@ void PythonShellWidget::AppendError(unsigned int id,const QString& output)
   verticalScrollBar()->triggerAction(QAbstractSlider::SliderToMaximum);
   ensureCursorVisible();
   repaint();
+  QApplication::processEvents();
 }
 
 void PythonShellWidget::set_block_type_(const QTextBlock& start, const QTextBlock& end, BlockType type)