[PyKDE] embedding PyQt in a c++ app
phil at riverbankcomputing.co.uk
Thu Jul 29 17:46:00 BST 2004
You don't say which version of SIP you are using.
With SIP 3.x PyQt will lock the GIL when it needs to and unlock it when it has
finished. The initial state of the GIL must be as PyQt is expecting - if you
are embedding PyQt this is easy to get wrong. In other words, it uses the
older GIL API.
With SIP 4.x PyQt will lock the GIL when it needs to and it isn't already
locked. When it has finished it restores the lock to its previous state. The
initial state of the GIL doesn't matter. In other words, it uses the newer
You are using the older, difficult to use, API. Try the newer one and SIP 4.x.
On Thursday 29 July 2004 4:21 pm, Christoph Wiedemann wrote:
> i have problems to embed PyQt in a c++ application. Since the application
> uses threads and multiple python interpreters, i must ensure that the
> correct thread state is set and the GIL is locked, whenever the python API
> is used. I do that with the
> methods. This works fine, as long as i don't use widgets created with PyQt,
> because there are many "callbacks" (virtual methods), e.g. mousePressEvent,
> which are called directly from PyQt.
> Is there any way to force PyQt to acquire the GIL before those virtual
> methods are called?
> Hmm, this wouldn't solve the issue with multiple interpreters; each
> interpreter has its own thread state, which must be restored before using
> the API.
> Maybe someone on this list has some ideas how to cope with this situation ?
> PyKDE mailing list PyKDE at mats.imk.fraunhofer.de
More information about the PyQt