ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxPython-users
wxPython-users
[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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved