[vtk-developers] New vtk packages; suggestions reqd. for othe r modules
Blezek, Daniel J (CRD)
blezek at crd.ge.com
Tue Oct 9 08:24:09 EDT 2001
Hi all,
> (2) Also, IMHO it is cleaner to have vtk.__init__.py load everything
> silently than have to have subpackage modules insert things into
> their parent packages' namespace.
I agree with this. Perhaps the "feature" of only loading kits that you need is a bit over-rated in
Python? In Tcl, it was a Good Thing, and helped make the Tcl interface a bit more useful, in the
case that you wanted to do batch processing. In Python does it make sense? People seemed to be
quite happy with "import vtkpython", and off you go. We are going down a path of gyrations that may
or may not be useful to Python developers. While it's good to do design up front, I suggest we
concentrate on makeing Python available to the widest possible audience, and keep the VTK-Python
interface as clean as possible. Here's my vote(No, it's not my final answer, Regis...):
>>> import vtk; # Loads all the kits, so I can do all things vtk
>>> import vtk.gui.tk; # Loads my favorite Tkinter widgets
This keeps everything neatly organized in one directory, and has a consistent, and elegant interface.
In truth, if a developer wanted to just load kits one at a time, they are likely sophisticated enough
to do a:
>>> import libvtkCommonPython; # or vtkCommonPython for Win32
and go to town. Perhaps if we made a note in the Python read me, or the VTK FAQ(is there one?), this
issue wouldn't be a problem.
> import vtk
> from vtkpkg.gui.tk import RenderWidget
> a = vtk.vtkSomeClass()
> r = RenderWidget()
>
> # or
> import vtkpkg.common
> a = vtkpkg.common.vtkSomeCommonClass()
>
> etc. All completely cleanly without any hacks or non-standard
> behaviour. Besides vtkpkg isnt too long a name to type (at any rate
> it is shorter than vtkpython :).
Cleanly, but not as elegant as I would like. Having vtk broken into two packages adds some
unnecessary complexity.
-dan
More information about the vtk-developers
mailing list