util.py 文件源码

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

项目:python-eduvpn-client 作者: eduvpn 项目源码 文件源码
def bytes2pixbuf(data, width=icon_size['width'], height=icon_size['height'], display_name=None):
    """
    converts raw bytes into a GTK PixBug

    args:
        data (bytes): raw bytes
        width (int): width of image
        height (int): height of images

    returns:
        GtkPixbuf: a GTK Pixbuf

    """
    loader = GdkPixbuf.PixbufLoader()
    loader.set_size(width, height)
    try:
        loader.write(data)
        loader.close()
    except GLib.Error as e:
        logger.error("can't process icon for {}: {}".format(display_name, str(e)))
    else:
        return loader.get_pixbuf()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号