def _set_images(self): for index, path in enumerate([ self.nudge_prefs['logo_path'], self.nudge_prefs['screenshot_path'] ]): if path in DEFAULT_IMAGES: local_png_path = join(self.nudge_path, path).replace(' ', '%20') else: local_png_path = join(path).replace(' ', '%20') foundation_nsurl_path = NSURL.URLWithString_( f'file:{local_png_path}') foundation_nsdata = NSData.dataWithContentsOfURL_( foundation_nsurl_path) foundation_nsimage = NSImage.alloc().initWithData_( foundation_nsdata) if index == 0: self.nudge.views[COMPANY_LOGO].setImage_(foundation_nsimage) else: self.nudge.views[UPDATESS].setImage_(foundation_nsimage)