Autocompletion for VTK Library using Homebrew Python ins OSX 10.7

Hello everyone,

I use pycharm 2.6 EAP under OSX 10.7 with a homebrew python installation and it's amazing!
One thing which bothers me though is the lack of autocompletion for my VTK-Library (http://www.vtk.org/). I've installed everything like described in my blog post under http://powernap.github.com/blog/2012/08/20/install-python-together-with-vtk-using-homebrew-for-mountain-lion/
I've added the custom installation in pycharm like seen here: http://cl.ly/image/3v3J0v3s0f0y. Everything compiles just fine.
The problem is that there is no autocompletion for VTK-Components, like seen here: http://cl.ly/image/2y3I1J3K1Q0h. VTK itself is recognized correctly and skeletons were build for it - it's objects are recognized like seen here: http://cl.ly/image/3c0U3z3W2R20. With exactly the same version loaded, eclipse together with pydev is able to build an autocompletion for this example (even though it's not perfect either): http://cl.ly/image/0Y2v3E1j1l18. Eclipse's python settings are as follows: http://cl.ly/image/2e2P1F3w1A3D.

Is it possible to somehow activate the autocompletion in pycharm in a similar fashion like eclipse does with pydev? It is really annoying to always look into the documentation for each method.

Thanks,
Paul
11 comments
Comment actions Permalink
Looks like "vtkImageShiftScale()" is highlighted as a warning on your screenshot from PyCharm. What does the warning say?
0
Comment actions Permalink
It says "vtkImageShiftScale is not callable". Every VTK function has this warning - I think that's the problem.

http://cl.ly/image/072b0F1L3P2A
0
Comment actions Permalink
What happens if you press "Goto definition" on vtkImageShiftScale?
0
Comment actions Permalink
I end on file called vtkImagingPython.py: http://cl.ly/image/3z2X3x0m2x09 (Folder opened in Finder: http://cl.ly/image/051A0p401F1P)
0
Comment actions Permalink
The problem happens because PyCharm is unable to build correct skeletons for the vtk library. I've filed an issue for this:
http://youtrack.jetbrains.com/issue/PY-7397
Unfortunately it looks like it's too late to fix the issue in the final 2.6 release, but I hope we'll be able to include the fix in a 2.6.x bugfix update.
0
Comment actions Permalink
This would be really great! If I can help you with code examples or anything else, please let me know. Thank you for the quick response :).
0
Comment actions Permalink
Hi there,

I know this is a quite old issue, but I still met exactly the same problem in my current PyCharm 4.0.6! VTK skeleton was built and PyCharm can give smart suggestion for "vtk" package, but is unable to deal with vtk variables.

BTW, the python program works well and gives right rendering result.

```
import vtk # Smart completion
cone = vtk.vtkConSource() # Smart completion
cone.SetResolution(60) # No suggestion at all
```

Any solutions?
0
Comment actions Permalink

+ 1 to Quan Qi's observed behavior. Using PyCharm 5.0.4

0
Comment actions Permalink

Same problems to Quan Qi's discription for both  VTK and OpenCV. Using 2016.1.

0
Comment actions Permalink

Meet the same problem.

# Environment:

* PyCharm 2016.2.3

* VTK 7.0

PyCharm autocomplete the method of the class itself, but not auto prompt the method inherit from supper class. e.g:

```

renWin = vtk.vtkRenderWindow()
renWin.AddObserver # not auto complete
renWin.AddRenderer # auto complete

```

1
Comment actions Permalink

Experiencing the same problem as Honhe.

PyCharm 2017.1.2

VTK 5.10.1

This is the version of VTK you get if you do a sudo apt-get install python-vtk.

0

Please sign in to leave a comment.