screenshot

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/python
import gtk.gdk
import time
def screenshot():
screen_dir = '/home/n3m0/'
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):
numb = time.time()
pb.save(screen_dir+str(numb)+".png","png")
return numb
else:
print "Unable to get the screenshot."
screenshot()