From: Jonathan B. <jbr...@ea...> - 2004-07-28 17:14:20
|
On Wed, 2004-07-28 at 12:58, Bruce Peterson wrote: > <<snip>>> > > This error was generated because you assigned the color of a label > > object to be a vector, when it wants a 3-tuple. > > > > If this is a serious problem for you, then I can implement a workaround > > that would accept any 3-element sequence to be a color, but I don't > > think it is appropriate to use vectors for specifying a color. > > > > In the meantime, you can use the built-in function tuple(sequence) to > > construct a tuple from any sequence (Visual's vectors are sequences), or > > you can use the special member function vector.as_tuple() for a faster > > That would be vector.astuple(), with no '_'. > > > conversion in performance-sensitive code. > > -Jonathan > > Thanks -- that worked -- I agree that colors are more appropriately tuples. > I was using a vector difference to define complementary colors so that a > label would show regardless of the background color. Since the default color for any new object is set to the foreground color of the display to which it is initially created, you could more easily accomplish what you want by setting scene.foreground to something appropriate. > I forgot to translate > the vector difference back to a tuple -- and the old VPython was willing to > accept this. HTH, -Jonathan |