인프런 커뮤니티 질문&답변
import pygame 실행이 안 돼요
작성
·
2.7K
퀴즈
65%나 틀려요. 한번 도전해보세요!
Pygame 창을 계속 열어두고 사용자 입력(예: 키보드, 마우스)에 반응하게 하려면 무엇이 필요할까요?
`pygame.quit()` 호출
`pygame.init()` 반복 호출
이벤트 루프 (Event Loop)
화면 크기 재설정
답변 1
0
import pygame만 하면 아무것도 안 뜨는게 맞습니다.
pip install game이 아니라 pip install pygame 아닌가요
import pygame
pygame.init()
screen = pygame.display.set_mode((600, 400))
pygame.display.set_caption("Test Project")
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
screen.fill((0, 0, 0))
screen.blit(pygame.font.Font(None, 30).render("Test", True, (255, 255, 255)), (100, 200))
pygame.display.update()
이 코드를 실행하고 흰색 Test 글자와 검은 배경이 뜨면 됩니다.

이렇게 뜨면 됩니다






