Retrive Python Treemodel RGBA data ignore red and green

Hi I setup a model column in python as:

color = Gdk.RGBA()
color.parse("rgba(170,60,60,0.6)")
item["color"] = color

And use in a treeview cell. It show well the color.
Anyway when I want to get the model RGBA later I get:

color.to_string()
ON set:
Gdk.RGBA(red=0.666667, green=0.235294, blue=0.235294, alpha=0.600000)
ON retrive:
Gdk.RGBA(red=0.000000, green=0.000000, blue=0.235294, alpha=0.600000)

Thanks in advance for get into.

We’re missing the bits on how you store and retrieve the color from the model. Could you please write a small, self-contained example that exhibits this issue, and post it here?

Hi Emmanuele, thanks for get into:

Python 3, Debian Sid, Glade with a RGBA default color in pos 3

This is basicaly what I try to add

widget = mytreeview
path = cursor[0]
// I want the color of the selected path
selection = widget.get_selection()
solicitud = (widget.get_model(), path)
if solicitud[0] and solicitud[1]:
    color = solicitud[0][solicitud[1]][3]
    if color:
        color = color.to_string() 
    else:
        color = "@theme_selected_bg_color;color:@theme_selected_fg_color"

I fix creating a string reperesentation in another column in the model but is a boring hack

I posted this bug a while ago, but it never got fixed. I, and other people as well, end up using a workaround of one kind or other.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.