[파이썬] 파이게임에서 전체화면
조회수 2451회
-
(•́ ✖ •̀)
알 수 없는 사용자
2 답변
-
다음 명령어를 호출하여 전체화면으로 변경할 수 있습니다.
pygame.display.set_mode(screensize, FULLSCREEN)
이를 적용한 전체 코드입니다.
import pygame from pygame.locals import * import ctypes # 해상도 구하는 용도 surface = pygame.display.set_mode((500, 500)) while True: for event in pygame.event.get(): if event.type == KEYDOWN: if event.key == ord('f'): # f 키를 눌렀을 때 user32 = ctypes.windll.user32 screensize = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1) # 해상도 구하기 surface = pygame.display.set_mode(screensize, FULLSCREEN) # 전체화면으로 전환 pygame.display.update() surface.fill((255, 255, 255))
도움이 되셨다면 좋겠습니다!
-
(•́ ✖ •̀)
알 수 없는 사용자
- 감사합니다 :) 알 수 없는 사용자 2020.3.18 21:47
- 그니까... surface 에다가 pygame.display.set_mode(screensize, FULLSCREEN) 를 다시 뒤집어 씌우는거네요 ㅎㅎ 알 수 없는 사용자 2020.3.18 21:55
- 도움이 되었습니다 감사합니다 알 수 없는 사용자 2020.3.18 21:55
-
-
이벤트 코드를 넣고 해당 이벤트가 발생하면 풀스크린으로 전환해야죠
하기 링크를 참고하세요.
https://www.pygame.org/wiki/toggle_fullscreen?parent=CookBook
댓글 입력