简单使用GDK例子- 截全屏幕图
Tofloor
poster avatar
lovesnow
deepin
2011-12-08 15:00
Author
  1. import gtk.gdk
  2. w = gtk.gdk.get_default_root_window()  
  3. width, height = w.get_size()         
  4. pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, width, height)
  5. pb = pixbuf.get_from_drawable(w, w.get_colormap(), 0, 0, 0, 0, width, height)
  6. if ( pb != None):
  7.     pb.save("screenshot.png", "png")
  8.     print "Screenshot saved to srceenshot.png"
  9. else:
  10.     print "Unable to get the screenshot"
Copy the Code

:roll:
Reply Favorite View the author
All Replies

No replies yet