본문 바로가기
프로그램

[파이썬] pygame 으로 원 그리기

by 오디세이99 2022. 9. 20.
728x90
반응형

 

import pygame

pygame.init()

BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)

screensize = [400, 300]
screen = pygame.display.set_mode(screensize)
pygame.display.set_caption("Drawing Rectangle")

done = False
clock = pygame.time.Clock()
while not done:
    clock.tick(10)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done=True

        screen.fill(WHITE)
        pygame.draw.circle(screen, BLUE, [60, 250], 40, 2)
        pygame.draw.circle(screen, RED, [60, 100], 50)
        pygame.draw.circle(screen, GREEN, [120, 150], 100, 2)
        pygame.display.flip()

pygame.quit()

728x90
반응형

댓글