pyqt设置程序左上角图标(图片来源网上)

def setLogo(self):
try:
if ~(os.path.exists("C:\\Logo.ico")):
url = "https://gitee.com/xdd1997/Download-or-Picture/raw/master/Logo.ico"
filepath = "C:\\Logo.ico"
urllib.request.urlretrieve(url, filepath)
self.setWindowIcon(QIcon('C:\\Logo.ico'))
except:
print("设置图标失败")

 

posted @ 2021-05-24 10:22  xdd1997  阅读(651)  评论(0编辑  收藏  举报