vtkPythonSmoke.py 843 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #
  2. # Copied from VTK/Common/Testing/Python/PythonSmoke.py
  3. #
  4. import qt
  5. try:
  6. import vtk
  7. except:
  8. print "Cannot import vtk"
  9. qt.QApplication.exit(1)
  10. try:
  11. print dir(vtk)
  12. except:
  13. print "Cannot print dir(vtk)"
  14. qt.QApplication.exit(1)
  15. try:
  16. try:
  17. try:
  18. o = vtk.vtkLineWidget()
  19. print "Using Hybrid"
  20. except:
  21. o = vtk.vtkActor()
  22. print "Using Rendering"
  23. except:
  24. o = vtk.vtkObject()
  25. print "Using Common"
  26. except:
  27. print "Cannot create vtkObject"
  28. qt.QApplication.exit(1)
  29. try:
  30. print o
  31. print "Reference count: %d" % o.GetReferenceCount()
  32. print "Class name: %s" % o.GetClassName()
  33. except:
  34. print "Cannot print object"
  35. qt.QApplication.exit(1)
  36. try:
  37. b = vtk.vtkObject()
  38. d = b.SafeDownCast(o)
  39. print b, d
  40. except:
  41. print "Cannot downcast"
  42. qt.QApplication.exit(1)
  43. qt.QApplication.exit(0)