[vtkusers] QVTKWidget is flickering

José M. Rodriguez Bacallao jmrbcu at gmail.com
Mon Jun 4 16:26:26 EDT 2012


thanks very much, it work like a charm!!!

On Mon, Jun 4, 2012 at 3:05 PM, Clinton Stimpson <clinton at elemtech.com> wrote:
>
> The flicker comes from converting the parent widget of QVTKWidget (in this
> case, your view manager) from an alien widget to a native one.
>
> In your Workspace.__init__, you can call
> self.view_manager.setAttribute(QtCore.Qt.WA_NativeWindow)
> so its a native window from the start.
>
> Clint
>
> On Monday, June 04, 2012 01:17:37 PM José M. Rodriguez Bacallao wrote:
>> I am using Archlinux, 64 and 32 bits, and using vtk 5.10.
>> I also tried setting self.view_manager.setUpdatesEnabled(False/True)
>> but nothing happens
>>
>> On Mon, Jun 4, 2012 at 1:04 PM, Clinton Stimpson <clinton at elemtech.com>
> wrote:
>> > Which platform... VTK version ?
>> >
>> > On Monday, June 04, 2012 12:55:34 PM José M. Rodriguez Bacallao wrote:
>> >> hi folks, as I posted previously, I am trying to use QVTKWidget with
>> >> QStackedWidget, I have two QStackedWidget nested one inside the other.
>> >> For examples, I have a QMainWindow and as central widget is a
>> >> QStackWidget that manage what I call "applications". An application is
>> >> a simple QWidget, and, in my case, is a QWidget with a QStackWidget
>> >> inside it that manage QVTKWidget's (image viewers). The problem arise
>> >> when I add a QVTKWidget to the internal QStackedWidget, it show ok
>> >> but, has an annoying flickering and I canot allow this in a medical
>> >> application, here I post an example code to demostrate what I mean:
>> >>
>> >>
>> >> from PyQt4 import QtGui, QtCore
>> >> import images, vtk
>> >>
>> >>
>> >> class Workspace(QtGui.QMainWindow):
>> >>
>> >>     def __init__(self, parent=None):
>> >>         super(Workspace, self).__init__(parent)
>> >>
>> >>         self.main_tb = self.addToolBar('main')
>> >>         self.add_action = self.main_tb.addAction('Add viewer')
>> >>         self.add_action.triggered.connect(self.add_viewer)
>> >>
>> >>         self.app_manager = QtGui.QStackedWidget(self)
>> >>         self.app_manager.setStyleSheet('background: red;')
>> >>         self.setCentralWidget(self.app_manager)
>> >>
>> >>         self.workspace_app = QtGui.QWidget(self.app_manager)
>> >>         self.view_manager = QtGui.QStackedWidget(self.workspace_app)
>> >>         self.view_manager.setStyleSheet('background: blue;')
>> >>         self.workspace_app_layout =
>> >> QtGui.QHBoxLayout(self.workspace_app)
>> >> self.workspace_app_layout.addWidget(self.view_manager)
>> >>
>> >>         self.app_manager.addWidget(self.workspace_app)
>> >>         self.app_manager.setCurrentWidget(self.workspace_app)
>> >>
>> >>     def add_viewer(self):
>> >>         viewer = vtk.QVTKWidget(self)
>> >>         self.renderer = vtk.vtkRenderer()
>> >>         self.renderer.SetBackground(0, 0, 0)
>> >>         viewer.GetRenderWindow().AddRenderer(self.renderer)
>> >>         self.view_manager.addWidget(viewer)
>> >>         self.view_manager.setCurrentWidget(viewer)
>> >>
>> >>
>> >> if __name__ == '__main__':
>> >>     app = QtGui.QApplication([])
>> >>     w = Workspace()
>> >>     w.showFullScreen()
>> >>     app.exec_()
>> >>
>> >> any ideas please, I need to solve this issue as quickly as possible
>> >> because of my deadline!!!.
>> >> _______________________________________________
>> >> Powered by www.kitware.com
>> >>
>> >> Visit other Kitware open-source projects at
>> >> http://www.kitware.com/opensource/opensource.html
>> >>
>> >> Please keep messages on-topic and check the VTK FAQ at:
>> >> http://www.vtk.org/Wiki/VTK_FAQ
>> >>
>> >> Follow this link to subscribe/unsubscribe:
>> >> http://www.vtk.org/mailman/listinfo/vtkusers
>> >
>> > --
>> > Clinton Stimpson
>> > Elemental Technologies, Inc
>> > Computational Simulation Software, LLC
>> > www.csimsoft.com
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
> --
> Clinton Stimpson
> Elemental Technologies, Inc
> Computational Simulation Software, LLC
> www.csimsoft.com



More information about the vtkusers mailing list