How to use a BorderNode

Hello I am trying to add a border to my snapshot in python with the following code:

rounded_rect = Gsk.RoundedRect()
rounded_rect.init_from_rect(rect, radius=90)  # rect is defined elsewhere
color = Gdk.RGBA()
color.parse("rgb(255, 255, 255)")
snapshot.append_border(rounded_rect, [5,5,5,5],  color)

But I keep getting the following error: TypeError: Must be sequence, not RGBA

But the docs specify that is must be a RGBA so I am a bit lost:

What am I missing here?

In the link you provided, it says an “array” of GdkRGBA with “4” elements.


Type: An array of GdkRGBA

The color used on the top, right, bottom and left side.

The array must have 4 elements.

Changing the line

snapshot.append_border(rounded_rect, [5,5,5,5],  color)


snapshot.append_border(rounded_rect, [5,5,5,5],  [color, color, color, color])

should fix it.

1 Like

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