Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40047 > unrolled thread

win32com how to catch events

Started byigorjan2332@gmail.com
First post2013-02-27 02:49 -0800
Last post2013-02-27 02:49 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  win32com how to catch events igorjan2332@gmail.com - 2013-02-27 02:49 -0800

#40047 — win32com how to catch events

Fromigorjan2332@gmail.com
Date2013-02-27 02:49 -0800
Subjectwin32com how to catch events
Message-ID<52692a42-6cdb-4c19-9f56-7fa2f313b7c4@googlegroups.com>
Hello,
I have a VBS sample code that I need to rewrite into python. It calls a com object which then generates events. My problem is that I don't know how to catch this events.
VBS sample looks like this:

Set oCOV = WScript.CreateObject( "RainbowObjectHandlerSrv.RainbowCOV", "oCOV_") ' like WithEvents in VB(A)

Sub oCOV_Update( ObjectId, ObjInstDataCOV)
       'some code
End Sub

I tried like this:

from win32com.client import DispatchWithEvents
class Events:
                def Update(self, ObjectID, Data):
                        print('update event')

oCOV = DispatchWithEvents("RainbowObjectHandlerSrv.RainbowCOV", Events)

my code can be found here: http://pastebin.com/EgfippzD
but the event newer gets called. Any idea what I'm doing wrong?

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web