def __pixel_at(x, y):
"""Returns (r, g, b) color code for a pixel with given
coordinates (each value is in 0..256 limits)"""
root_window = gdk.get_default_root_window()
buf = gdk.pixbuf_get_from_window(root_window, x, y, 1, 1)
pixels = buf.get_pixels()
if type(pixels) == type(""):
rgb = tuple([int(byte.encode('hex'), 16) for byte in pixels])
else:
rgb = tuple(pixels)
return rgb
评论列表
文章目录