On Mar 25, 7:49 am, Matthew Marshall <[email protected]>
wrote:
> All colors in rabbyt (and pyglet) are in the range 0..1.  That's how
> they are with OpenGL.  You get used to it pretty quick :-)

Actually, some pyglet colors are from 0..1 and others are from 0..255,
depending on the API -- for example:

.../pyglet-1.1.2-docs/doc/html/programming_guide/formatted_text.html

    Character styles

    The following character styles are recognised by all TextLayout
classes.

    color

        4-tuple of ints in range (0, 255) giving RGBA text color

    background_color

        4-tuple of ints in range (0, 255) giving RGBA text background
color; or None for no background fill.

Before I noticed this discrepancy, I tried to modify examples/
text_input.py like this:

    def ToggleColor(self):
        attrVal = self.focus.caret.get_style('color')
        if attrVal:
            new = None
        else:
            new = (1, 0, 0, 1) # red
        self.focus.caret.set_style({'color':new})

and the text was not visible, presumably since its alpha was 1/255!
(Or maybe it was the Label text in hello_world.py which I tried this
with, I forget.) It works correctly in this form:

    def ToggleColor(self):
        attrVal = self.focus.caret.get_style('color')
        if attrVal:
            new = None
        else:
            new = (255, 0, 0, 255) # red
        self.focus.caret.set_style({'color':new})

(In fact, maybe this possibility of alpha == 1/255 should be listed in
the FAQ as another reason your window can be blank. And another one is
just using the same text color and bg color. How does one modify the
FAQ page, anyway?)

- Bruce Smith
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to