If your thread is long running and it is not possible to easily set a flag for it to check and bail out, then how does it display the progress in the progress dialog. How often does that get updated? If the progress dialog is updated often, then at each update have the thread check a self.please_die flag, for example, and break out (possibly after releasing some resources...).
Having the work done in an external process might or might not work easily for your problem. It will make it easy to kill the execution but it might be OS dependent, and you will have to define some communication interface between your processes (for example, how would an external process easily provide progress feedback to its parent?). Patrick Smith wrote: > Hi, > I'm hoping someone here will be able to help as I've been struggling with > this problem for a few days now. > > I'm working on an application that is creating a ProgressDialog, and then > creating a thread that runs a function from another module in the program. > > The problem is, when the cancel button on the ProgressDialog is pressed, the > thread that was created continues to run. How can I make it so that when > the cancel button on the dialog is clicked, the spawned thread dies? > > thanks -- http://mail.python.org/mailman/listinfo/python-list