Events in win32com

Mark Hammond MarkH at ActiveState.com
Thu Dec 21 05:59:32 CET 2000


Paul Moore wrote:

> Is it possible to do anything like this in Python? If not, can I do
> the same thing another way? (I have created ie via
> DispatchWithEvents(), but the HTML document is a property of this. Can
> I rewrap it somehow, say as
>   doc = DispatchWithEvents(ie.document, DocEvents)

This is (should be) as simple as instantiating a sub-class of the makepy 
generated event class, and passing the document.

eg, something like:

mod = EnsureModule(...)

class MyEvents(mod.IDocumentEvents):
   # your methods here....

handler = MyEvents(ie.document)

# handler should start recieving events.

Mark.




More information about the Python-list mailing list