[python] pygame 윈도우 샘플

pygame으로 윈도우를 띄우는 샘플코드입니다.


import pygame

# 윈도우 타이틀
pygame.display.set_caption('Tutorial 1')

# 배경화면 색상
background_color = (255,255,255)

# 윈도우 사이즈
(width, height) = (300, 200)
screen = pygame.display.set_mode((width, height))
screen.fill(background_color)

# 윈도우 표기
pygame.display.flip()

running = True
while running:
    for event in pygame.event.get():
        # 닫기 버튼 감지
        if event.type == pygame.QUIT:
            running = False



아래는 실행결과입니다.



끝.

댓글

이 블로그의 인기 게시물

공압 속도 제어: 미터인 vs 미터아웃

[PLC] PLC 아날로그 입출력 기본

[아두이노] 가변저항(Potential Divider)과 전압분배(Voltage Divider)

제너 다이오드에 저항을 연결하는 이유

[PLC] 프로그래밍 - SFC Conversion 기법 (1)

[스마트팜] 코코피트 수경재배

[자동화] 스마트 재배기의 온도 조절 방법

커패시터에 저장된 에너지 계산

전력(kW) 계산하기 (직류, 교류 단상, 교류 삼상)

공압회로 기호