-
-
Save samueljohn/3090097 to your computer and use it in GitHub Desktop.
Revisions
-
samueljohn revised this gist
Jul 11, 2012 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,10 +4,10 @@ """ try: from PySide import QtCore, QtGui except ImportError: try: from PyQt4 import QtCore, QtGui except ImportError as err: raise ImportError("Cannot load either PyQt or PySide") @@ -43,4 +43,4 @@ widget.show() # start event processing sys.exit(app.exec_()) -
samueljohn revised this gist
Jul 11, 2012 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,6 @@ """ A simple example that uses the QVTKRenderWindowInteractor class. """ try: -
samueljohn renamed this gist
Jul 11, 2012 . 1 changed file with 9 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,17 @@ """ A simple example that uses the QVTKRenderWindowInteractor class. """ try: from PyQt4 import QtCore, QtGui except ImportError: try: from PySide import QtCore, QtGui except ImportError as err: raise ImportError("Cannot load either PyQt or PySide") if __name__ == '__main__': # every QT app needs an app -
fmorency revised this gist
May 4, 2012 . 1 changed file with 0 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,11 +9,6 @@ import vtk import sys if __name__ == '__main__': # every QT app needs an app app = QtGui.QApplication(['QVTKRenderWindowInteractor']) @@ -25,7 +20,6 @@ def output_picked_point(caller, id, data=None): # if you dont want the 'q' key to exit comment this. widget.AddObserver("ExitEvent", lambda o, e, a=app: a.quit()) ren = vtk.vtkRenderer() widget.GetRenderWindow().AddRenderer(ren) -
fmorency created this gist
May 4, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ """ A simple example that uses the QVTKRenderWindowInteractor class. """ #from PySide import QtGui from PyQt4 import QtGui from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor import vtk import sys def output_picked_point(caller, id, data=None): picker = caller.GetPicker() print 'Point id: %s' % picker.GetPointId() if __name__ == '__main__': # every QT app needs an app app = QtGui.QApplication(['QVTKRenderWindowInteractor']) # create the widget widget = QVTKRenderWindowInteractor() widget.Initialize() widget.Start() # if you dont want the 'q' key to exit comment this. widget.AddObserver("ExitEvent", lambda o, e, a=app: a.quit()) widget.AddObserver("EndPickEvent", output_picked_point) ren = vtk.vtkRenderer() widget.GetRenderWindow().AddRenderer(ren) cone = vtk.vtkConeSource() cone.SetResolution(8) coneMapper = vtk.vtkPolyDataMapper() coneMapper.SetInputConnection(cone.GetOutputPort()) coneActor = vtk.vtkActor() coneActor.SetMapper(coneMapper) ren.AddActor(coneActor) widget.SetPicker(vtk.vtkPointPicker()) # show the widget widget.show() # start event processing sys.exit(app.exec_())