[vtkusers] about PyQt4 and vtk

Lic. José M. Rodriguez Bacallao jmrbcu at gmail.com
Thu Oct 15 17:08:03 EDT 2009


hi folks, I'm trying to embed an QVTKRenderWindowInteractor in a mdi
subwindow of a PyQt4 application but it raise a lot of BadWindows
errors and Seg Faults like this:

X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 2 (X_ChangeWindowAttributes)
  Resource id:  0x340004b
X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 3 (X_GetWindowAttributes)
  Resource id:  0x340004b

this is an example code:

import sys

from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
from PyQt4 import QtGui


class Window(QtGui.QMainWindow):

    def __init__(self, title):
        super(Window, self).__init__()

        self.setWindowTitle(title)

        file_menu = self.menuBar().addMenu('&File')
        file_menu.addAction('&New Scene', self.new_scene)


        self.mdi = QtGui.QMdiArea(self)
        self.setCentralWidget(self.mdi)
        self.interactors = []

    def new_scene(self):
        rwi = QVTKRenderWindowInteractor(self)
        self.interactors.append(rwi)
        scene = self.mdi.addSubWindow(rwi)
        scene.show()


app = QtGui.QApplication(sys.argv)
window = Window('Test')
window.showMaximized()
app.exec_()

-- 
Lic. José M. Rodriguez Bacallao
Centro de Biofisica Medica
-----------------------------------------------------------------
Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo.

Recuerda: El arca de Noe fue construida por aficionados, el titanic
por profesionales
-----------------------------------------------------------------



More information about the vtkusers mailing list