Question

Is there a way to get a screenshot of a glade/gtkbuilder UI xml by code (preferrably C)?

Was it helpful?

Solution

You have to create a window and display it in the ordinary way. There is no way to do it "just for show", so to say. For GTK 2 you also have to display the window (make it visible on screen) and then make a screenshot of it. In GTK 3 (which doesn't support the old glade format, just the newer gtkbuilder one) it is possible to render to memory. So theoretically it should be possible to just render the window and save it to a file without involving X (or any other particular back end).

There are pictures of all widgets in the manual for GTK (which is included in the source release). I don't know for sure, but perhaps they are automatically generated in some way. It might be worth looking into.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top