[PyKDE] How to test if two PyQt instances wrap the same C++ object?

Gerard Vermeulen gvermeul at grenoble.cnrs.fr
Wed Oct 22 11:12:01 BST 2003


On Wed, 22 Oct 2003 10:38:21 +0200
Aurélien Gâteau <aurelien at dental-on-line.fr> wrote:

> Le Mercredi 22 Octobre 2003 10:19, Gerard Vermeulen a écrit :
> >         if ( object == (QObject *)axis(yLeft) )  // HOW TO THIS IN PYTHON?
> Not sure at all, but maybe this will do:
> 
>    if object is axis(yLeft):
> 
> Hope this helps,

Nope, 'is' tests for 'object identity'. The Python type of object is a QObject
and the return type of QwtPlot.axis(QwtPlot.yLeft) a QwtScale with a different
address, but both PyQt objects may hold the same C++-pointer.

Gerard




More information about the PyQt mailing list