[Python] 纯文本查看 复制代码 import pygame
import sys
pygame.init()
pygame.display.set_caption('这里是标题')
screen = pygame.display.set_mode((800,600))
clock = pygame.time.Clock()
x,y = 400,300
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
print(keys)
x -= 10
if keys[pygame.K_DOWN]:
x += 10
if keys[pygame.K_UP]:
y -= 10
if keys[pygame.K_RIGHT]:
y += 10
screen.fill((255, 255, 255))
pygame.draw.circle(screen, (0, 250, 100), (x, y), 20)
clock.tick(24)
pygame.display.update() |