How do I take a screenshot using GdkPixbuf?

﹥>﹥吖頭↗ 提交于 2019-12-21 20:18:27

问题


Using PyGTK, I used to be able to take a screenshot using gtk.gdk.pixbuf.get_from_drawable.

I can't seem to figure out how to do that using PyGObject and GdkPixbuf. I've tried get_from_drawable and get_from_window but neither work in PyGObject.

Thanks in advance.


回答1:


Use Gtk.OffscreenWindow:

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


来源:https://stackoverflow.com/questions/14544500/how-do-i-take-a-screenshot-using-gdkpixbuf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!