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

Andrew Maclean andrew.amaclean at gmail.com
Fri Aug 31 05:30:07 EDT 2012


I meant to add that I am also happy to write a vtkNamedColors class if you
guys think it would be worthwhile.
>From my viewpoint it would be great to have an alternative to things like:
SetColor(0.2,0.3,0.4).

I promise I will use "color" and not "colour" !

Regards
  Andrew

Sent from an Android tablet.
On Aug 31, 2012 7:21 PM, "Will Schroeder" <will.schroeder at kitware.com>
wrote:

> +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/c0402755/attachment.html>


More information about the vtk-developers mailing list