[vtkusers] pre-defined colours in Python?

David Gobbi dgobbi at irus.rri.ca
Tue Feb 12 17:22:03 EST 2002


Hi Elvis,

Python doesn't have a built-in colour database, but you
can build one from the 'rgb.txt' file that comes with X11
(assuming you are running UNIX).  On my system, the file
is located in /usr/X11R6/lib/X11/rgb.txt and has entries
like this:

! $XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp $
255 250 250             snow
248 248 255             ghost white
248 248 255             GhostWhite

If you're keen you can write a function that reads the file into a
python dict for quick lookup e.g.

RGB['ghost white'] = (255, 250, 250)
...

 - David


On Tue, 12 Feb 2002, Chen, Elvis wrote:

> sorry for another Python/VTK newbie question:
>
> How do I access pre-defined colours within python?
>
> In tcl, one can get pre-defined colours as system
> variables:
>
>   eval [isoActor GetProperty] SetColor $antique_white
>
> what would be the python translation then?
>
> i.e. isoActor.GetProperty().SetColor( ???? )
>
> thx!
>
> ______________________________________________________________________
> Web-hosting solutions for home and business! http://website.yahoo.ca
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list