[vtk-developers] Manual conversion of some Tcl to Python tests.

Andrew Maclean andrew.amaclean at gmail.com
Fri Aug 31 05:14:10 EDT 2012


Hi Nikhil, Berk,
I was able to easily rewrite contour2D.tcl and contour3D.tcl to
Python, however in doing this I have a question.

With respect to contour3D.tcl it uses colour names to specify the
colours. In converting I have used the existing file colors.py.
However this means that you pollute the Python functions with a large
number of variables defined e.g as:
antique_white = (0.9804, 0.9216, 0.8431)

To me this can be more simply done as a dictionary in Python.

However in considering this approach a second thought has occurred to
me in that it would be nice to have in VTK 6 a class of colors and
their names.
What do people think of creating a class called say vtkNamedColors
where the underlying structure would be a std::map<std::string,
std::vector> with this map prefilled with the colours defined in
colors.py or colors.tcl?
There would be only two functions e.g GetColor(std::string) returning
a std::vector and SetColor(std::string, std::vector) - this function
would allow the user to add new colours.

Hopefully this would be wrapped and easy to use in Python etc. thus
removing the need for colors.py.

Regards
   Andrew

-- 
___________________________________________
Andrew J. P. Maclean

___________________________________________



More information about the vtk-developers mailing list