# Print output does not immediately appear in Python console

**URL:** <https://discourse.slicer.org/t/print-output-does-not-immediately-appear-in-python-console/32825>\
**Category:** Development\
**Created:** [November 14, 2023, 9:23pm UTC](https://discourse.slicer.org/t/print-output-does-not-immediately-appear-in-python-console/32825 "2023-11-14T21:23:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MLDawn](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mldawn/32/66882_2.png) [@MLDawn](https://discourse.slicer.org/u/MLDawn)\
**Post date:** [November 14, 2023, 9:23pm UTC](https://discourse.slicer.org/t/print-output-does-not-immediately-appear-in-python-console/32825/1 "2023-11-14T21:23:14Z")

</div>

May I ask a basic question. In my python script I keep printing messages using Python’s print() commant. However, these messasges will not appear instantly! For example, if the user pushes a button in my Python plugin, a long script is executed and in the mittle I have inserted print commands. However, none of them appear, until the entire function of the button is executed! Is there an easy way to fix this? Thanks.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 15, 2023, 5:14am UTC](https://discourse.slicer.org/t/print-output-does-not-immediately-appear-in-python-console/32825/2 "2023-11-15T05:14:36Z")

</div>

You need to give a chance for the application to paint the messages into the console. The easiest way to do it is to call `slicer.app.processEvents()` after the `print` command.

---

<div class="post-metadata">

**Author:** ![MLDawn](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mldawn/32/66882_2.png) [@MLDawn](https://discourse.slicer.org/u/MLDawn)\
**Post date:** [November 15, 2023, 10:47am UTC](https://discourse.slicer.org/t/print-output-does-not-immediately-appear-in-python-console/32825/3 "2023-11-15T10:47:31Z")

</div>

Thanks a lot! It worked like a charm!!!
