[vtkusers] pre-defined colours in Python?

Chen, Elvis anisotropic7 at yahoo.ca
Tue Feb 12 17:33:43 EST 2002


hi David,

thx again for the rapid reply.  Your suggested
solution is exactly what I have used so far.  I'm
using Solaris so the 'rgb.txt' is located under
/usr/openwin/lib instead.

I also need to divide the integer values by 255.

ttyl,

--- David Gobbi <dgobbi at irus.rri.ca> wrote:
> 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
> >
> 
> _______________________________________________
> 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


______________________________________________________________________ 
Web-hosting solutions for home and business! http://website.yahoo.ca



More information about the vtkusers mailing list