For the past 2 hours I have been trying to get PyQt4 and VTK to work together. Sure there is a VTK+PyQt4 example and also plenty of PyQt documentation but when I would try to embed the VTK widget inside my application window I would get garbage and the terminal would be flooded with millions of:
X Error: BadWindow (invalid Window parameter) 3 Major opcode: 3 (X_GetWindowAttributes) Resource id: 0x380000e X Error: GLXBadDrawable 146 Extension: 135 (Uknown extension) Minor opcode: 5 (Unknown request) Resource id: 0x380000e X Error: GLXBadDrawable 146 Extension: 135 (Uknown extension) Minor opcode: 5 (Unknown request) Resource id: 0x380000e
After examining the code for the QVTKRenderWindowInteractor.py widget I decided to try subclassing it from the Qt OpenGL widget (the way the wxPython equivalent does it) instead of the plain vanilla QWidget... but it still didn't work... so I went back to default implementation and kept trying to find the problem. I fixed a silly bug in my code and things started to crash in a different way (progress!). Another couple of interweb searches uncovered a QVTKRenderWindowInteractor.py version that, like my version, used QGLWidget as its base class, so I switched back to my version and everything started working.
The result is that the interface was faster than the wxPython version (maybe because I am running KDE), and fit all my requirements. But to my horror I discovered that PyQt is GPL (Qt is LGPL which led to the confusion) and my code is [New] BSD... I really really dislike the GPL (why?) and spent a while searching the internet to see if using GPL python libraries is ok with BSD code. I even asked in #python and received a very out of character for #python but typically unhelpful IRC reply of "Ask your lawyer". Anyway as it turns out the Trolltech GPL exception allowed me to dodge the GPL bullet.