Rendering to a PyQt window

424 views
Skip to first unread message

Stefan Stammberger

unread,
May 4, 2008, 6:24:58 AM5/4/08
to Python Ogre Developers
Hi,

I'm currently trying to render to a PyQt window using python-ogre. The
problem I'm facing now is how to get the hwnd
from PyQt. I know the function QWidget.winId() returns the hwnd in the
form of a sip.voidptr object. Now how do I convert the ptr into a
hwnd?

Thanks,
Stefan Stammberger

Krešimir Špes

unread,
May 4, 2008, 6:32:41 AM5/4/08
to Python Ogre Developers
isn't hWnd just a void* ?

Stefan Stammberger

unread,
May 4, 2008, 6:49:12 AM5/4/08
to Python Ogre Developers
I think hWnd is an unsigned int not a pointer.

Anyway I think I have found a solution. I have been converting the
sip.voidptr into a string using str() wich was wrong. It resulted in
the string <sip.voidptr object at 0x00B7C0A0>.
This is what I have passed to Ogre as render window. Ogre
understandably refused to render into this non existing window :). But
when I convert the pointer into an int using int()
I think I'm getting the real Windows winId wich is in my case at the
moment 854498.

Krešimir Špes

unread,
May 4, 2008, 11:56:16 AM5/4/08
to Python Ogre Developers
hmm, you're right, it's an usigned int. how does this work on
windows? what does pyqt return?

if you solve the issue, you could write a small article on the wiki to
help others who encounter it.

Stefan Stammberger

unread,
May 4, 2008, 2:26:57 PM5/4/08
to Python Ogre Developers
I'll do for sure. Pyqt returns the sip.voidptr wich just can be
converted to an int with pythons int().
Reply all
Reply to author
Forward
0 new messages