Handling Com Events in Python (was Python and Windows Scripting Host)

Alex Martelli alex at magenta.com
Thu Aug 10 04:40:46 EDT 2000


"Syver Enstad" <syver.enstad at sensewave.com> wrote in message
news:8msq5k$tn6$1 at troll.powertech.no...
> > Hmm, yes, but that mixes up the object you're automating with the
> > one that's receiving/handling its events.  I find that somewhat
> > unpleasant/untrivial.
>
> I am not sure if I understand here, how is the object that is handling the
> events mixed up with the one we're automating?

win32com.client.DispatchWithEvents returns an object which is an
instance of a class which inherits both from the one of the object
we're automating, and from the one we supplied (as a parameter
to DispatchWithEvents) and which implements the response to
events.  Multiple inheritance of implementation is always slightly
complex, aka non-trivial, I think; here, in particular, we're mixing
two things which, while related, have conceptually distinct
identities.  Nothing too terrible, I guess (and I don't have a better
architecture to propose, really; I ended up implementing something
rather similar when I COM-enabled a proprietary scripting language
that we develop and distribute with our applications -- although
there are, I think, a few worthwhile enhancements which could be
taken from that architecture and applied to Python's win32com,
it's really minor issues).  But it's better to be aware of it.


Alex






More information about the Python-list mailing list