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.

1 Like

You can use pango markup in a GtkLabel.

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.

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