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

Will Schroeder will.schroeder at kitware.com
Fri Aug 31 05:21:06 EDT 2012


+1

On Fri, Aug 31, 2012 at 5:14 AM, Andrew Maclean
<andrew.amaclean at gmail.com>wrote:

> 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
>
> ___________________________________________
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>


-- 
William J. Schroeder, PhD
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
will.schroeder at kitware.com
http://www.kitware.com
(518) 881-4902
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20120831/620536d4/attachment.html>


More information about the vtk-developers mailing list