Skip to content

Instantly share code, notes, and snippets.

@Ciremun
Created May 26, 2021 20:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ciremun/2228cac52f21949699f6e109adb1b75a to your computer and use it in GitHub Desktop.
Save Ciremun/2228cac52f21949699f6e109adb1b75a to your computer and use it in GitHub Desktop.
dogs AYAYAHop
import time
import io
import pygame
import requests
from PIL import Image
pygame.init()
display = pygame.display.set_mode((800, 600))
ded = False
while not ded:
for event in pygame.event.get():
if event.type == pygame.QUIT:
ded = True
r = requests.get('https://dog.ceo/api/breeds/image/random')
r = requests.get(r.json()['message'])
image = Image.open(io.BytesIO(r.content))
surface = pygame.image.fromstring(image.tobytes(), image.size, image.mode)
display.fill((0, 0, 0))
display.blit(surface, (0, 0))
pygame.display.flip()
time.sleep(1)
pygame.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment