-
StackOverflow 文件
-
pygame 教程
-
建立一個 pygame 視窗
-
建立 pygame 視窗
import pygame
background_colour = (255,255,255) # For the background color of your window
(width, height) = (300, 200) # Dimension of the window
screen = pygame.display.set_mode((width, height)) # Making of the screen
pygame.display.set_caption('Tutorial 1') # Name for the window
screen.fill(background_colour) #This syntax fills the background colour
pygame.display.flip()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.quit()