sending signals to the calling function

Haim Ashkenazi haim at babysnakes.org
Mon Jun 28 05:31:57 EDT 2004


On Mon, 28 Jun 2004 12:14:29 +0300, Haim Ashkenazi wrote:

> Hi
> 
> I have a function that receive a list of files and creates a zip from
> these files. I want it to send signal to the calling function with the
> name of the file it currently compressing. is there a way to do this
> (without threads)?
Hi, again...

here's a more detailed description:

at the moment, the function looks like this:

def CreateZip(self):
    bakFile = 'data_backup_NS.zip'
    
    print "\nCompressing your data...\n"
    myZip = zipfile.ZipFile(bakFile, 'w', zipfile.ZIP_DEFLATED)
    
    for file in self.FinalList:
	print "adding", file, "..."
	# zip doesn't support unicode
	if isinstance(file, unicode):
	    myZip.write(file.encode('mbcs')) #good for windows
	else:
	    myZip.write(file)
	
    myZip.close()

it works fine when called from a console application, but now I want it to
be called from a wxwindows gui also (and redirect the output to a
wxScrolledMessageDialog). if there isn't a way to "signal" the calling
function, is there a way to redirect the output of the function (it's
running on windows)?

thanx
-- 
Haim






More information about the Python-list mailing list