Help: Capturing COM events

Rush rusha at data-tech.com
Thu May 31 15:13:00 EDT 2001


I have a COM object (activeX dll) that adds fax support.  I'm trying
to build a simple demo in PythonWin, and I need some advice on how to
write the code to capture my object's events.

I can instantiate the object, set its properties and call its
Methods().

So far, I've been working like this:

from Tkinter import *
import win32com.client

#instantiate the FMJR objects
myTool = win32com.client.Dispatch("FaxTool.FaxTool.1")
myFF = win32com.client.Dispatch("FaxFinder.FaxFinder.1")
myDD = win32com.client.Dispatch("DeviceDesc.DeviceDesc.1")

And, I can do things like:
myTool.FaxNumber="555-1212"
myTool.FaxFile="c:\myfax.xxx"
myTool.SendFax()

All of this works great! I can send faxes all day!  I couldn't be
happier.

Now, when I call my object's SendFax() method, my object starts firing
a Status event.

In VB, I capture the Status Event like this:

Private Sub FaxTool_Status(ByVal bsMsg As String)
     ***DO STUFF IN HERE***
End Sub

I realize VB abstracts the need for me to write an event wrapper.

So, my question becomes, how do I write Python code to capture my
object's Status Event?

Many Thanks.



More information about the Python-list mailing list