Show an image from a file
image from online source.py
import pygame
pygame.init()
screen = pygame.display.set_mode((400, 300))
done = False
#pull image from an online source:
import requests
url_atari = requests.get("https://digisoln.com/resources/atari.gif")
#load image into file-like object:
import io
img_atari = pygame.image.load(io.BytesIO(url_atari.content))
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
screen.blit(img_atari, (200, 0)) #x, y
pygame.display.flip()
pygame.quit()