How do I take a screenshot using GdkPixbuf?

Using PyGTK I used a screenshot with gtk.gdk.pixbuf.get_from_drawable

.

I cannot figure out how to do this using PyGObject and GdkPixbuf. I tried get_from_drawable

and get_from_window

but didn't work in PyGObject.

Thanks in advance.

+3


source to share


1 answer


Use Gtk.OffscreenWindow

:



offscreen_window = Gtk.OffscreenWindow()
offscreen_window.add(widget_that_needs_screenshotting)
pixbuf = offscreen_window.get_pixbuf()

      

+2


source







All Articles