본문 바로가기
프로그래밍/Python

pygame 창 배경색 설정 surface fill

by 그레이 후드 2022. 12. 4.
728x90

pygame 실행 창 배경색을 설정하는 fill 명령

import pygame
import sys
from pygame.locals import QUIT

pygame.init()
Surface = pygame.display.set_mode((600, 300))
FPSCLOCK = pygame.time.Clock()
pygame.display.set_caption("Test")

def main():
    while True:
        # 배경색 설정
        Surface.fill((50,150,70))
        
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()

        pygame.display.update()
        FPSCLOCK.tick(30)

if __name__ == '__main__':
    main()

 

 

728x90

댓글