[PyQt] boost python windget in a pyqt widget

Phil Thompson phil at riverbankcomputing.com
Thu Aug 11 17:32:59 BST 2011


On Thu, 11 Aug 2011 09:15:32 -0700, Josh Stratton
<strattonbrazil at gmail.com> wrote:
> Is there an example of that somewhere?

PyQt itself.

> Is that on the python side or
> the C++ side?

I don't understand the question.

> Does that mean I cannot use boost::python and need to
> switch to SIP?

Yes, for your Qt widgets.

Phil

> On Thu, Aug 11, 2011 at 9:10 AM, Phil Thompson
> <phil at riverbankcomputing.com> wrote:
>> On Thu, 11 Aug 2011 08:48:20 -0700, Josh Stratton
>> <strattonbrazil at gmail.com> wrote:
>>> Is it possible to add qt widgets from a cmodule to a pyqt class?
>>>
>>> For example if I have a widget MyWidget in mytest.so,
>>>
>>> from pyqt import *
>>> import mytest
>>>
>>> widget = mytest.MyWidget() # C++ qt widget
>>> window = QtGui.QMainWindow()
>>> window.setCentralWidget(widget) # put C++ widget in pyqt widget
>>>
>>> window. show()
>>>
>>> This will cause a type error trying to add widget to the window.
>>
>> You need to wrap MyWidget using SIP.
>>
>> Phil
>>


More information about the PyQt mailing list