Is it only me having the problem that I can’t set a color to a TextNode using Panda 1.0.5?
text = TextNode('textNode')
text.setText("Every day in every way I'm getting better and better.")
text.setAlign(TextNode.ACenter)
text.setSmallCaps(1)
text.setColor(0,0,0,.8)
text.setCardColor(0,0,0,.8)
textNodeP = render.attachNewNode(text)
But Pand3D gets angry and tells me:
What am I doing wrong? The interesting thing is that everything else is working… as soon as i comment the text.setColor() out, everything is fine…
Hmmm… Okay, Yellow helped me a bit… he said that I should try to using
textNodeP.setColor(1,0,0,1)
what brought me indeed a red text… but after that one worked I wanted to have a CardColor - kinda decent background colour…
But now this is giving me a hard time… setCardColor cannot be used on parented textNodes - they need to be used on the textNode BEFORE parenting (so not on the nodePath), otherwise Panda is shouting again.
Well, I thought I can live with that and was somewhat disturbed that the background got no colour at all… OK, could be the margins that were used in the manual that I didn’t set - so I set them as well…
Yep, something is working - but not as supposed. The whole textnode gets now the colour I sent along with setColor - not only the text or the background… BOTH.
Here is the text…
text = TextNode('textNode')
text.setText("Every day in every way I'm getting better and better.")
text.setCardColor(0,1,0,7)
text.setCardAsMargin(0, 0, 0, 0)
text.setAlign(TextNode.ACenter)
text.setSmallCaps(1)
textNodeP = render.attachNewNode(text)
textNodeP.setPos(0,5,0)
textNodeP.setScale(0.5)
textNodeP.setColor(1,0,0,1)
Can please somebody give a working(!) short demo prog of how to set up a text node with coloured text and a background colour in a different colour? Thanks [/b]