I posted an issue on gitlab (https://gitlab.gnome.org/GNOME/pygobject/-/issues/439), but was told to post it here instead.
I have an application written using pygobject with Gtk4. I have been working on a feature which allows the application to take screenshots of itself for documentation purposes.
I believe the “front door” for taking a screenshot would be:
- Get a
- Grab the main
- Use a
Gsk.Rendererto convert the
- Save the
Gdk.Textureto a file.
There are other ways, involving
cairo , but every way I’ve found depends on
Gsk in some way or another.
I have noticed a few issues when using these
Gsk.CairoRenderer.render_textureseems to expect a
GObjectas the first argument, but it actually takes a
GskRenderNodewhich is not a
GObject. As a result, I don’t believe it can be used.
GskRenderNode.serializecauses the application to seg. fault.
cairo.Contextcauses the application to seg. fault.
My questions are as follows: Is Gsk supported in
pygobject? Will it be supported in the future? What is the best way to take a screenshot of the application?