python - 将 vtkOrientationMarkerWidget 与 QVTKRenderWindowInteractor [PyQt4/PySide] 一起使用

标签 python pyqt4 pyside vtk qvtkwidget

我使用 QVTKRenderWindowInteractor 小部件类在 PySide/vtk GUI 上工作。 该小部件运行良好,除非我尝试使用 vtkOrientationMarkerWidget 添加方向轴(参见图片):

axesActor = vtk.vtkAxesActor();
axes = vtk.vtkOrientationMarkerWidget()
axes.SetOrientationMarker(axesActor)
axes.SetInteractor(self.iren)
self.ren.AddActor(axesActor)
axes.EnabledOn() # <== application freeze-crash
axes.InteractiveOn()

类似bug has been already reported for ubuntu ,表明该错误仅在 Qt example 下重现, 而相同的 example without Qt效果很好。

对这种行为有什么解决办法吗? enter image description here

最佳答案

从 Nicholas R. Rypkema 那里得到了这个答案:

https://nrr.mit.edu/blog/note-about-vtk-pyqt-and-vtkorientationmarkerwidget

长话短说:这将解决您的问题

axesActor = vtk.vtkAxesActor();
self.axes = vtk.vtkOrientationMarkerWidget()
self.axes.SetOrientationMarker(axesActor)
self.axes.SetInteractor(self.iren)
self.ren.AddActor(axesActor)
self.axes.EnabledOn() # <== application freeze-crash
self.axes.InteractiveOn()

关于python - 将 vtkOrientationMarkerWidget 与 QVTKRenderWindowInteractor [PyQt4/PySide] 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37675602/

相关文章:

qt - 如何创建将QAbstractItemModel的节点展平到PySide中的列表的代理模型?

python - PySide 子线程中的计时器

python - 检查矩阵是否有值

python - 从 python 脚本运行进程,进程永远不会停止

python - PyQt QTabBar 不创建新选项卡

python-2.7 - Python & Ubuntu 14.04\ 删除手动安装的python版本

python - 为什么在 gmail API 中搜索返回的结果与在 gmail 网站中搜索返回的结果不同?

python - Django:列出模型的所有反向关系

python - 如何将 PyQt 脚本 (.py) 编译为适用于 windows (.exe) 和/或 linux 的单个独立可执行文件?

python - 单击事件在 pyside 的 textedit 中不起作用