win32com how to catch events
igorjan2332 at gmail.com
igorjan2332 at gmail.com
Wed Feb 27 05:49:10 EST 2013
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?
More information about the Python-list
mailing list