utils.py 文件源码

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

项目:Icon-Requests 作者: bil-elmoussaoui 项目源码 文件源码
def get_icon(icon_path):
    """
        Generate a GdkPixbuf image
        :param image: icon name or image path
        :return: GdkPixbux Image
    """
    try:
        if "symbolic" in icon_path:
            icon = (None, icon_path)
        else:
            icon = GdkPixbuf.Pixbuf.new_from_file(icon_path)
            if icon.get_width() != 48 or icon.get_height() != 48:
                icon = icon.scale_simple(48, 48, GdkPixbuf.InterpType.BILINEAR)
        return icon
    except GLib.Error:
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号