GtkLabel and Inline Images

I’ve currently stumbled across an issue I’m not sure how to solve. Background: I currently work in Fractal and Social, apps for Matrix and Mastodon, respectively. Both of these services support custom images within text. If I want to write fully functioning clients I’d need to be able to support this. Is there any way to load things other than plain text for GtkLabels, or do I need to write my own GtkWidget subclass?

i am not sure about Labels but Textviews are able to show images. You can style it like a label. maybe this helps.

You can use pango markup in a GtkLabel.

https://developer.gnome.org/pygtk/stable/pango-markup-language.html

This doesn’t address the image issue but it will let you format the text.

There’s already a library I’m using to handle formatting - Images are what’s left.

Another way to approach it would be to wrap the Label in an EventBox (derived from Bin) and then you can stuff whatever you want in there.

The only caveat is that the migration docs from GTK3 to GTK4 advise that the EventBox will likely be deprecated going forward.