0

I'm using the Python Cocos2D game library and in their docs you can find cocos.text.Label which accepts color=RGBA(int, int, int, int) as params. I've got the following code create a Label:

self.name = cocos.text.Label("Test Label",
                      font_name='Times New Roman',
                      font_size=22,
                      color=(163, 42, 44, 1),
                      anchor_x='center', anchor_y='center')
self.name.position = (10, 90)
self.add(self.name)

This code is attached to a cocos.layer.Layer and rendered in a Scene initiated in the director.

The issue is this: if I remove the color param from the Label the Label is created correctly and displayed as White color, but if specified color, then the label is just never rendered. Not even black its just not there.

Any help on why this is happening and how to change Label color is very appreciated.

I'm using python 3.4.3 and latest version of python-cocos2d. I'm willing to update and post any code so feel free to ask. Thanks in advance.

Aitor Martin
  • 724
  • 1
  • 11
  • 26

1 Answers1

2

Maybe you just can't see the label? The A in RGBA goes from 0 to 255. Value 1 is almost transparent. Try color=(163, 42, 44, 255).

  • Oh wow, I checked the Alpha in pyglet and it was from 0.1 to 1.0, I didnt think about it being in range 0-255 !!! Thanks this was it. – Aitor Martin Jul 07 '15 at 15:53