Convert a GTK python script to C
- by Jessica
The following script will take a screenshot on a Gnome desktop.
import gtk.gdk
w = gtk.gdk.get_default_root_window()
sz = w.get_size()
pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,False, 8, sz[0], sz[1])
pb = pb.get_from_drawable(w, w.get_colormap(), 0, 0, 0, 0, sz[0], sz[1])
if (pb != None):
pb.save("screenshot.png", "png")
print "Screenshot saved to screenshot.png."
else:
print "Unable to get the screenshot."
Now, I've been trying to convert this to C and use it in one of the apps I am writing but so far i've been unsuccessful. Is there any what to do this in C (on Linux)?
Thanks!
Jess.