[PyKDE] ActiveX

Robert Knapp myddrin at myddrin.com
Wed Dec 8 19:43:52 GMT 2004


On Wednesday 08 December 2004 8:14 am, Hihn, Jason wrote:
> Does anyone know what it would take to get a QDialog  to display in a
> browser via PyQt? I'm hoping there's a simple example somewhere.

My solution (can't post code because of NDA) was to wrap it in a C++ object 
that used the ActiveQT library.  Basically, the C++ object initializes python 
inside of itself, imports the module and wraps each of the methods.  Because 
you are basically writing the same method over and over and over, I would 
suggest looking at writing a script to generate the code.  That is what I 
did, and it worked out great. (However, pay close attention to the rules 
about python threads vs QT threads....that will really clobber you in this 
config.)

Keep in mind, if you have any timing or threading issues lurking in the 
background, this solution will let you know about them very quickly.  (I had 
a timing issue that only appeared something like once in a thousand runs w/ 
the normal python environment, but every time in IE.....)

Also keep in mind that your methods will execute much more slowly than pure 
C++ ones.  If all you need is a dialog box, it might be worth it to simply 
write an activex component or look at the VBScript messagebox function.
(Since I don't know for sure what you are doing, it is hard to tell).  For my 
needs, we were hitting a server so the extra overhead (about 75ms per call) 
wasn't that big of a deal.

If you don't need full blown activeX you can use pythoncom pretty easily.  
However you will need to instantiate the QApplication, etc.

Doing it that way you can get events in VB, but not in IE.  At least the last 
time I checked pythoncom(part of win32all) did not have support for some of 
the interfaces you need to do a full blown activex control that way.

All of that being said, I would go for the pythcom solution if you don't 
absolutely need events.  It's alot smoother than the solution I found...sadly 
my needs at the time required events so I had to do it the hard way.
>
>
>
> Thanks!
>
>
>
> ___________________________________________________________________________
>_______________ This electronic message may contain proprietary and
> confidential information of Verint Systems Inc., its affiliates and/or
> subsidiaries. The information is intended to be for the use of the
> individual(s) or entity(ies) named above.  If you are not the intended
> recipient (or authorized to receive this e-mail for the intended
> recipient), you may not use, copy, disclose or distribute to anyone this
> message or any information contained in this message.  If you have received
> this electronic message in error, please notify us by replying to this
> e-mail. (1)




More information about the PyQt mailing list