diff --git a/main.py b/main.py index 4c0c135f61696bcf42c375ca5ab62aa5b105afc8..37205dc9e94daf6e2d2a9a0c6e3fdec44fbb1209 100644 --- a/main.py +++ b/main.py @@ -1 +1,25 @@ -print('欢迎来到 InsCode') \ No newline at end of file +import pygame + +pygame.init() +width = 800 +height = 600 +screen = pygame.display.set_mode((width, height)) +pygame.display.set_caption("My Pygame Window") + +# 游戏循环 +running = True +while running: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + running = False + + # 填充背景色 + screen.fill((255, 255, 255)) + + # 绘制其他内容 + pygame.draw.circle(screen, (255, 0, 0), (width//2, height//2), 50) + + # 更新窗口 + pygame.display.flip() + +pygame.quit()