AiraPulsar/vgl/test.py
2025-04-04 22:19:27 +08:00

29 lines
585 B
Python

import pygame
import sys
# 初始化 Pygame
pygame.init()
# 设置窗口大小
screen = pygame.display.set_mode((800, 600))
# 设置颜色 (RGB)
background_color = (255, 255, 255) # 白色背景
line_color = (255, 0, 0) # 红色线条
# 主循环
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
# 填充背景
screen.fill(background_color)
# 绘制抗锯齿线条
pygame.draw.aaline(screen, line_color, (100, 100), (700, 500))
# 更新显示
pygame.display.flip()