Changing cursor during long running script

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.

I think this should work:

qt.QApplication.setOverrideCursor(qt.Qt.WaitCursor)
myFunctionThatTakesLongToExecute()
qt.QApplication.restoreOverrideCursor()
2 Likes