Created
May 26, 2021 20:44
-
-
Save Ciremun/2228cac52f21949699f6e109adb1b75a to your computer and use it in GitHub Desktop.
dogs AYAYAHop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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