[vtkusers] about PyQt4 and vtk

Clinton Stimpson clinton at elemtech.com
Thu Oct 15 20:27:28 EDT 2009


That's probably because reparenting is not implemented for 
QVTKRenderWindowInteractor.
You could probably get around it by making an intermediate QWidget that 
is the parent and put that in the mdi area.

Clint

On 10/15/2009 03:08 PM, Lic. José M. Rodriguez Bacallao wrote:
> 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_()
>
>    




More information about the vtkusers mailing list