This is one OLD thread, and you must have solved it..but for the reference
:
Code:
import threading
import time
def selfDestruct():
task = nuke.ProgressTask("Self Destructing")
task.setMessage("Deleting files")
for i in xrange( 0, 100 ):
if task.isCancelled():
nuke.executeInMainThread( nuke.message, args=( "Phew!" ) )
break;
task.setProgress(i)
time.sleep( 0.5 )
threading.Thread( None, selfDestruct ).start()
I googled a lot for the same problem, but found no solution, so I hope someone might find it useful