hwphillips wrote:
>> I have written a program which involves a long
process of copying
>> files/converting files. I would like for the user
to be able to stop the
>> process. I put a "stop" menu item, but the program
doesn't respond. The
>> window titlebar goes white and nothing happens till
the
>> copying/converting process is over. Any assistance
would be appreciated.
>>
>Try putting a wx.SafeYield() or wx.Yield() inside of
>your long running
>loop and see if that helps.
I believe that's not enough. To do this kind of
things, you need to get into multi-threaded
programming. Start a worker thread to loop over the
processing task. Inside the loop, do a check to see
if the GUI created any changes (like a mouse click)
and if it does, you know to stop.
The GUI code, of course, has to know that a worker
thread has been started, and take action to make sure
that the user doesn't start another one while the
first one is working (like disable a button or something).
--
John Henry
|