[PyQt] QAxBase.dynamicCall - calling convention

Frank Hempel red_socks at gmx.de
Tue Feb 5 15:23:43 GMT 2013


Hello,

I'm wondering how to call a function of an activex control with more the 8
parameters. Regarding the Qt doc the QAxBase->dynamicCall() can be called
in two ways, with at max 8 separate parameters or with a list of variable
length.

Using dynamicCall from python only seems to work when specifying all
parameters separately, only usefull for less or equal 8 parameters. Can
someone confirm that using the "parameters-as-list calling convention" is
not wrapped into python? Or is there some special indication needed to
have it that way?

Thanks for any hints...

Regards,
Frank

Attached some lines of code illustrating the situation:

import sys
from PyQt4 import QAxContainer
from PyQt4.QtCore import QVariant
from PyQt4.QtGui import QMainWindow, QApplication

class MainWindow(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
        axc = QAxContainer.QAxWidget(self)
        self.setCentralWidget(axc)
        axc.setControl('{8856F961-340A-11D0-A96B-00C04FD705A2}')          
     # Webbrowser

        params = [QVariant(x) for x in ("www.google.com", 0, "", "", "")]

        # following line works as "*params" is identical to "params[0],
params[1], params[2], params[3], params[4]"
        axc.dynamicCall("Navigate(QString, QVariant&, QVariant&,
QVariant&, QVariant&)", *params)

        # this one does does not work in the sense, that the browser
control only shows the typical "site cannot be displayed" message
        axc.dynamicCall("Navigate(QString, QVariant&, QVariant&,
QVariant&, QVariant&)", params)

app = QApplication(sys.argv)

window = MainWindow()
window.show()

app.exec_()



More information about the PyQt mailing list