def screenshot(): try: import os os.environ["DISPLAY"]=delegator.run("who").out.split()[1] import gtk.gdk os.environ["DISPLAY"]=delegator.run("who").out.split()[1] 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("/tmp/screenshot.png","png") return 0 else: return 1 except Exception as e: return 1Video on Youtube
© 2021, All Rights Reserved · Vipin Joshi