[wxPython-users] Controlling threads
by Davor Cengija other posts by this author
Mar 23 2003 4:09PM messages near this date
[wxPython-users] time control
|
[wxPython-users] Re: Controlling threads
I have a CLI python program for which I'm writing GUI. The program takes a
number of files and filters them.
def OnStartButtonClick(self, event):
w = Worker(directory)
w.start()
I'd like to have the worker in a background thread so that GUI keeps
responding to events, and even more important, to have STOP button (which
will, I presume, put some kind of stopper object in some kind of queue,
which that background thread should check periodically.)
I'm very new to Python and I don't know how to implement that. The
following url explains some details but I wasn't able to incorporate it in
my program:
http://www.python.org/cgi-bin/moinmoin/ThreadProgramming
GUI still doesn't respond.
My Worker object is single-threaded (it takes one file after another).
Maybe I should rewrite it to something like
for file in directoryList:
w = Worker(file)
w.start()
and basically have new Worker for each file.
Also, it is important that I should be able to stop the processing of a
single file at any given time, even in the middle of the process.
So, after all these requests, is there any good examples which I could use?
I already read the Threads example in the demo collection, but to be
honest, I really don't understand it :-)
Thanks in advance!
Regards,
Davor
--
davor.cengija@[...].hr
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@[...].org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
Thread:
Davor Cengija
Davor Cengija
Joe Brown
Chuck Esterbrook
|