[vtkusers] about PyQt4 and vtk

Lic. José M. Rodriguez Bacallao jmrbcu at gmail.com
Sat Oct 17 08:43:56 EDT 2009


I realize that after a night of sleeplessness, thanks very much for
your help. Here is another question: I have made my
QVTKRenderWindowInteractor parent of QWidget and put the QWidget as a
the Widget of my MDI windows, but, when I change the active MDI
windows, I get some flicker and a little ghost image of my previous
window.

PS: I am visualizing DICOM images in each MDI window

On 10/15/09, Clinton Stimpson <clinton at elemtech.com> wrote:
>
> 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_()
>>
>>
>
>


-- 
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