[PyQt] Accessing the underlying Qt object in a C-API extension.

Phil Thompson phil at riverbankcomputing.com
Wed Aug 12 15:45:40 BST 2009


On Wed, 12 Aug 2009 07:34:13 -0700, Christian Caron <ccaron at fattoc.com>
wrote:
> Hi All,
> 
> First things first: I think PyQt is awesome. Now onto the question.
> 
> I sometimes have small pieces of code that I would like to speed up  
> using a C-API extension.
> I'd like to be able to pass PyQt objects to an extension, and once  
> inside dig up the internal Qt pointer...
> 
> Is this a difficult (or possible at all) thing to do?
> 
> I looked through the archives before posting but failed to find  
> something relevant.
> 
> Sample code would be great.

Write your C++ extension as a library - just like one of the Qt libraries.

Write SIP bindings for your library - just like the PyQt modules.

Your C++ doesn't need to be aware of Python at all, the SIP generated code
will take care of all that.

Phil


More information about the PyQt mailing list