这无需使用scrot或ImageMagick即可工作。
import gtk.gdkw = gtk.gdk.get_default_root_window()sz = w.get_size()print "The size of the window is %d x %d" % szpb = 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."
从http://ubuntuforums.org/showpost.php?p=2681009&postcount=5借来的
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)