py_stepik/mod_pygame/test_pygame_works.py

29 lines
750 B
Python
Raw Normal View History

2024-03-29 13:12:08 +00:00
import pygame
WIDTH = 1000
HEIGHT = 1000
def draw_background_image(screen, filename):
background = pygame.image.load(filename)
screen.blit(background, (0, 0))
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Тест Pygame")
draw_background_image(screen, "assets/bg1k.png")
2024-03-29 13:16:20 +00:00
pygame.draw.line(screen, pygame.Color("Green"), [10, 100], [700, 700], 3)
pygame.draw.rect(screen, pygame.Color("red"),(350, 20, 100, 175))
pygame.draw.polygon(screen, pygame.Color("red"), points=[(50,100), (100,50), (350,100)])
pygame.draw.circle(screen, pygame.Color("blue"), (500, 500), 100)
2024-03-29 13:12:08 +00:00
pygame.display.flip()
while pygame.event.wait().type != pygame.QUIT:
...
pygame.quit()