나도코딩_Python_GUI_1) 윈도우 규격 만들기

728x90

1) 파이썬 GUI 윈도우 규격 만들기 : 규격은 480 X 640 크기이다. 

import pygame

pygame.init() #초기화 (반드시 필요)

#화면 크기 설정 
screen_width = 480 #가로 크기 
screen_height = 640 #세로 크기 
screen = pygame.display.set_mode((screen_width, screen_height))

#화면 타이틀 설정 
pygame.display.set_caption("YongJu Game ") #게임이름 

# 이벤트 루프
running = True #게임이 진행 중 ? 
while running:
    for event in pygame.event.get(): # 어떤 이벤트가 발생하였는가 ? 
        if event.type == pygame.QUIT: #창 닫히는 이벤트 발생여부
            running = False #게임 진행 중 X

# pygame 종료
pygame.quit()

[실행결과화면] : 윈도우 규격은 변수에 설정해놓았던 480 X 640 이 된다. 

                  화면 타이틀은 pygame.display.set_caption("     ") 으로 설정 

728x90