Taking screenshot using python

The correct way to take an Screenshot using PyGobject (the Gtk version used by Quickly) is:

from gi.repository import Gdk

window = Gdk.get_default_root_window()
x, y, width, height = window.get_geometry()

print("The size of the root window is {} x {}".format(width, height))

# get_from_drawable() was deprecated. See:
# https://developer.gnome.org/gtk3/stable/ch24s02.html#id-1.6.3.4.7
pb = Gdk.pixbuf_get_from_window(window, x, y, width, height)

if pb:
    pb.savev("screenshot.png", "png", (), ())
    print("Screenshot saved to screenshot.png.")
else:
    print("Unable to get the screenshot.")

The first version you posted is for the older PyGtk. So it works on console because it only loads PyGtk. In Quickly apps, PyGobject is loaded, and you cannot load both. You got stuck looking for get_from_drawable(), see section "GdkDrawable is gone":

https://web.archive.org/web/20140808005032/https://developer.gnome.org/gtk3/stable/ch24s02.html#id-1.6.3.4.7