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

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Wed Oct 3 23:39:00 EDT 2001


hi,

>>>>> "DG" == David Gobbi <dgobbi at irus.rri.ca> writes:

    DG> from libvtkHybridPython import *

    DG> under UNIX and

    DG> from vtkHybridPython import *

    DG> under Windows.  There should be a platform-independent way to
    DG> load just a single kit.

Yes, I mentioned a possible approach in my reply to Daniel Blezek's
post.  I'll requote that part:

vtk/
__init__.py
common.py
...

Where common.py just has the following: 

import os
if os.name == 'posix':
   from libvtkCommonPython import * 
else:
   from vtkCommonPython import *

The question is how should __init__.py be?  Or should we have an
all.py that loads everything?  We could put 

from common import *
from hybrid import * 

in all.py or inside __init__.py.  The problem with __init__.py is that
even if one did

import vtk.common

then the one could still access the whole library like so:

vtk.vtkObject()

Is this desireable?  It does provide a platform independant approach
to loading a single kit but also loads all kits underneath.  What do
you think?


prabhu



More information about the vtk-developers mailing list