import requests import pygame from sys import exit url = 'https://www.apiopen.top/satinApi?type=1&page=1' resp = requests.get(url) all_dict = resp.json() list1 = all_dict["data"] num = 0 for i in list1: img = requests.get(i["profile_image"]) with open('img' + str(num) + '.jpg','bw') as f: f.write(img.content) num += 1 num = 0 pygame.init() screen = pygame.display.set_mode((300,300)) screen.fill((255,255,255)) pygame.display.flip() image = pygame.image.load('img'+str(num) + '.jpg') new_image = pygame.transform.scale(image,(300,300)) screen.blit(new_image,(0,0)) pygame.display.flip() while True: for event in pygame.event.get(): if event.type == pygame .QUIT: exit() screen.fill((255, 255, 255)) pygame.time.delay(1000) image = pygame.image.load('img' + str(num) + '.jpg') new_image = pygame.transform.scale(image,(300, 300)) screen.blit(new_image,(0,0)) pygame.display.flip() num += 1