[PyKDE] embedding python widgets in C++ app
patrickkidd.lists at gmail.com
Mon Jan 22 09:21:07 GMT 2007
oops, I think the title is backwards. I will send the author an email.
I am trying to embed a python widget in a C++ application, where he is
trying to access his C++ app code from his python code.
I decided to manually import a module with a factory function, call
that factory function from C++ and convert the python object to a
QWidget * using sipConvertToInstance. After doing this, I have a few
What should the transfer object be as passed to sipConvertToInstance?
I'm a little confused about the wording in the documentation, and
sipTransferObj is automatically included if you are using this in a
How are you supposed to statically link the PyQt libraries if you then
lose the PyQt4 package, which initQtGui() expects to import QtCore
from? initQtCore() works fine but initQtGui() fails looking for
Any comments on the following code?
PyObject *module = PyImport_ImportModule(nameBuf);
PyObject *_create = PyObject_GetAttrString(module, "_create");
PyObject *sipPy = PyObject_Call(_create,
int iserr = 0;
QWidget *widget = reinterpret_cast<QWidget
*>(sipConvertToInstance(sipPy, sipClass_QWidget, NULL, SIP\
_NO_CONVERTORS, 0, &iserr));
if(iserr == 0 && widget)
qDebug("GOT WIDGET %p", widget);
ret = widget;
qWarning("could not sip => widget");
qWarning("error in _create return (%p)", sipPy);
qWarning("error \"_create\" is not callable");
qWarning("no attribute \"_create\"");
qWarning("no module \"pktest\"");
On 1/20/07, Patrick Stinson <patrickkidd.lists at gmail.com> wrote:
> Bingo. thanks for that, I think that turtorial will help quite a bit.
> On Mon, 15 Jan 2007 07:51:28 -0800
> "Patrick Stinson" <patrickkidd at gmail.com> wrote:
> > I know I've seen info here and there about using python widgets in C++ apps,
> > but I need a recap.
> > So I've already got this great C++ app with an embedded interpreter for
> > scripting special app functions. What do I need to do to write a widget in
> > python and use it as a child in my C++ app?
> On 1/19/07, Andreas Pakulat <apaku at gmx.de> wrote:
> > On 19.01.07 21:41:34, Patrick Stinson wrote:
> > > oh, right. I noticed a bit later that I sent it from an unregistered
> > > adress, so I never got the replies. I wasn't sure if my message made
> > > it to the list either..
> > >
> > > would you mind copying the replies to this message? maybe it's already
> > > in the archive...
> > http://mats.imk.fraunhofer.de/pipermail/pykde/2007-January/015178.html
> > And following mails.
> > Andreas
> > --
> > You need more time; and you probably always will.
> > _______________________________________________
> > PyKDE mailing list PyKDE at mats.imk.fraunhofer.de
> > http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
> Patrick Kidd Stinson
Patrick Kidd Stinson
More information about the PyQt