[PyQt] Can't seem to send parameter by reference using PyQt

Sam Myers morefigs at gmail.com
Thu Aug 21 01:50:53 BST 2014

I'm having trouble sending a parameter by reference using dyncamicCall to
an ActiveX object. The command GetNumHWUnits should set the second
parameter to 2, but doesn't change it. The equivalent code works in LabVIEW
so I'm reasonably confident in the command order. Any hints?

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

class APTSystem(QMainWindow):

    def __init__(self):


        apt = QAxContainer.QAxWidget(self)

        apt.setControl('{B74DB4BA-8C1E-4570-906E-FF65698D632E}')   # system


        typ = QVariant(6)
        num = QVariant(0)

        apt.dynamicCall('GetNumHWUnits(int, int&)', [typ, num])

        print num.toInt()   # value is always returned as zero, expecting 2!


app = QtGui.QApplication(sys.argv)
a = APTSystem()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140821/659a84d9/attachment.html>

More information about the PyQt mailing list