I've got a PySide/VTK application, connected using the QVTKRenderWindowInteractor. PySide 1.0.9 works ok on Unix based systems with a QT4.8/VTK 5.8. (all Python 2.7.3)
Then I port on a Microsoft Windows system (XP 32), with PySide win32 distribution (1.1.x) Qt4 and VTK 5.10, and I have a type error in QVTKRenderWindowInteractor while retrieving the self.winId() which is expected to be castable as int:
TypeError: int() argument must be a string or a number, not 'PyCObject'
The PySide API actually says the PySide.QtGui.QWidget.winId() returns a long...
I'm starting some more tests on both MS-Windows and Unix, but maybe some of you could give me a piece of advice? What and where do I have to look for?
Could it be related to a bad cast of this long on a 32bits system, produced by the PySide interface generator to Qt?
Replace this row by:
WId = self.winId()
if type(WId).__name__ == 'PyCObject':
from ctypes import pythonapi, c_void_p, py_object
pythonapi.PyCObject_AsVoidPtr.restype = c_void_p
pythonapi.PyCObject_AsVoidPtr.argtypes = [py_object]
WId = pythonapi.PyCObject_AsVoidPtr(WId)
self._RenderWindow.SetWindowInfo(str(int(WId)))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.