# Changing cursor during long running script

**URL:** <https://discourse.slicer.org/t/changing-cursor-during-long-running-script/19190>\
**Category:** Development\
**Tags:** python, scripted\
**Created:** [August 14, 2021, 12:38am UTC](https://discourse.slicer.org/t/changing-cursor-during-long-running-script/19190 "2021-08-14T00:38:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ezgimercan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ezgimercan/32/4584_2.png) [@ezgimercan](https://discourse.slicer.org/u/ezgimercan)\
**Post date:** [August 14, 2021, 12:38am UTC](https://discourse.slicer.org/t/changing-cursor-during-long-running-script/19190/1 "2021-08-14T00:38:44Z")

</div>

Is there a way to change the cursor to spinning pinwheel when a long running function is called after a button is pressed in a scripted module? Right now the UI freezes until the function returns but no visual feedback to the user. Thanks.

---

<div class="post-metadata">

**Author:** ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)\
**Post date:** [August 14, 2021, 9:15am UTC](https://discourse.slicer.org/t/changing-cursor-during-long-running-script/19190/2 "2021-08-14T09:15:37Z")

</div>

I think this should work:

```auto
qt.QApplication.setOverrideCursor(qt.Qt.WaitCursor)
myFunctionThatTakesLongToExecute()
qt.QApplication.restoreOverrideCursor()

```
