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("设置图标失败")