Re: [Goocanvas-devel] fill/stroke_color_rgba on 32-bit machines using python bindings



On Sun, 2009-04-26 at 01:15 +0200, Bruno Coudoin wrote:
> Le samedi 25 avril 2009 à 11:05 -0700, Brandon Lewis a écrit :
> > Bruno Coudoin wrote:
> > > Le vendredi 17 avril 2009 à 00:20 -0700, Brandon Lewis a écrit :
> > >> I am having some difficulty with setting colors on goocanvas objects on 32-bit 
> > >> machines. Essentially what I do is pack the values from a gtk.gdk.Color object 
> > >> into a 32-bit word and assign it to the fill/stroke color properties.
> > >>
> > >> The problem is that on 32-bit machines, some color values exceed python's limit 
> > >> on the size of an int (since it has no unsigned type) and get promoted to longs. 
> > >> When this happens, the goocanvas bindings can't convert the value (which is 
> > >> still only 32-bits wide)
> > >>
> > >> Anyone have any suggestions on how to deal with this?
> > > 
> > > You can force python to set a long value by appending an L at the end of
> > > the value like in color_rgba= 0xF44B9DFFL
> > > 
> > 
> > But then goocanvas will reject it. All this does is specify that the literal 
> > value is a long. The issue is that goocanvas refuses to convert python longs to 
> > ints even when the value would fit within 32-bits.
> 
> I confused. Please give an example of what does not work for you. In
> GCompris there are tons of code that sets colors and I got no issue once
> I append a L to the value.

The simple-demo/demo.py uses fill_color_rgba:

                               fill_color_rgba = 0x3cb3f180
                               stroke_color = "blue",

If I change that to white, 0xffffffff, or red, 0xff0000ff, it works fine
here (on a 32-bit machine).

Does that work OK there?

Damon




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]