[pdfwin.py] how to build a Python VARIANT Object for messageHandler

12 views
Skip to first unread message

Laurent Delosieres

unread,
Feb 9, 2018, 12:33:11 PM2/9/18
to wxPython-users
Hi,

I am not so familiar with COM objects, especially with Python. I am using the PDFWindow class to open a PDF via Python, nevertheless, I cannot get the Adobe ActiveX events such as OnMessage and OnError. I tried to implement those two methods in the class PDFWIndow, but none of them are triggered. I noticed in the previous version of PDFWindow, a member called "messageHandler" was used, very likely to get the messages from the Adobe ActiveX component. Nevertheless, my problem resides in the conversion of a Python object to a VARIANT. I  tried automation.VARIANT(obj), but this is not working.

class Events(object):
        def OnMessage(self, event):
            pass

        def OnError(self, event):
            pass

events = Events()
pdf.messageHandler = automation.VARIANT(events)  <-- issue

Your help is more than welcome.

Best,
Laurent
Reply all
Reply to author
Forward
0 new messages