简体   繁体   中英

PySide and VTK on Windows 32

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?

see line 152 http://sourceforge.net/p/pycgns/code/ci/17b696c3b0ad2b387b7e0ddc5d9b195cbc6abf70/tree/NAVigater/CGNS/NAV/Q7VTKRenderWindowInteractor.py

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM