Aitor Martin
Aitor Martin

Reputation: 734

Python Cocos2d Label class is ignoring color

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.

Upvotes: 0

Views: 365

Answers (1)

user2373682
user2373682

Reputation:

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).

Upvotes: 2

Related Questions