[vtk-developers] New vtkpython.py - comments.

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Wed Oct 3 11:10:50 EDT 2001


hi,

>>>>> "DJB" == Daniel J Blezek <Blezek> writes:

    DJB>   IMHO, this is really a bad idea to have to know which kit a
    DJB> class is in.  I was thinking more of loading classes in

Agreed.

    DJB> libvtkCommonPython.so into the vtk namespace, when you import
    DJB> vtk.common.  The advantage is that you do not need to have
    DJB> Tkinter available for most of the kits(just Rendering), and
    DJB> so now batch Python/VTK jobs become available.  I'm not good

Well, right now you could definitely import vtkpython without Tkinter.
If you just import vtkpython you dont need an X server at all.  Also
it is certainly possible to import something like
libvtkRenderingPython, atleast under linux.

$ python
>>> from libvtkRenderingPython import *
>>> a = vtkActor()

No problems - atleast at this point.  

the libvtk*Python.so's are modules and I think they get their internal
stuff from the libvtk*.so's so there really arent severe dependency
problems.  I guess David is the expert on this.

    DJB> enough with python to know if this sort of thing is possible
    DJB> though...  A "import vtk.graphics" would manage the
    DJB> dependancies it has on vtk.common, etc... and only load what
    DJB> you need.

I think this should be possible - if not already possible.  Maybe all
we need to do is do something like this:

vtk/
__init__.py
common.py
...

common.py just has the following: 
import os
if os.name == 'posix':
   from libvtkCommonPython import * 
else:
...

similarly for the rest.  This should definitely work.  What we want to
put into __init__.py is not completely clear.  I dont know if we can
get both.  Maybe we use vtkpython.py to import everything inside the
vtk dir??

    DJB> But the option of just loading a few packages should also be
    DJB> available.  We could also have a vtk.test package to facilite
    DJB> testing under python, which is woefully under-represented.

I have not received any more input on what you folks want me to do
with my test code?? :(  

prabhu



More information about the vtk-developers mailing list