utils.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:furi-kura 作者: benjamindean 项目源码 文件源码
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()

    if not root_window:
        return tuple([0, 0, 0])

    buf = Gdk.pixbuf_get_from_window(root_window, x, y, 1, 1)
    pixels = buf.get_pixels()
    if isinstance(pixels, str):
        rgb = tuple([int(byte.encode('hex'), 16) for byte in pixels])
    else:
        rgb = tuple(pixels)
    return rgb
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号