Files
PL_2026/lab2/task1.py

47 lines
1.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import pygame
from pygame.draw import *
pygame.init()
FPS = 30
screen = pygame.display.set_mode((400, 400))
# ЦВЕТА
GRAY = (200, 200, 200) # Светло-серый фон
YELLOW = (255, 255, 0) # Жёлтое лицо
BLACK = (0, 0, 0) # Чёрный (контуры, рот, брови)
RED = (255, 0, 0) # Красные глаза
# ФОН
screen.fill(GRAY)
# === ЛИЦО ===
# Жёлтый круг
circle(screen, YELLOW, (200, 200), 100)
circle(screen, BLACK, (200, 200), 100, 3)
#ГЛАЗА
circle(screen, RED, (165, 170), 18) # Левый
circle(screen, RED, (235, 170), 18) # Правый
circle(screen, BLACK, (165, 170), 8) # Левый
circle(screen, BLACK, (235, 170), 8) # Правый
РОdb
line(screen, BLACK, (140, 145), (185, 165), 8)
line(screen, BLACK, (260, 145), (215, 165), 8)
rect(screen, BLACK, (150, 240, 100, 15))
pygame.display.update()
clock = pygame.time.Clock()
finished = False
while not finished:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
finished = True
pygame.quit()