[Python] 纯文本查看 复制代码 import pygame
# 导入游戏环境
from game import *
import sys
from pygame.color import THECOLORS
x = 0
white = 255, 255, 0
blue = 0, 0, 200
# 初始化
pygame.init() # pygame 初始化
screen = pygame.display.set_mode((800, 600)) # 创建屏幕
clock = pygame.time.Clock() # 生成游戏时钟
myfont = pygame.font.Font(None, 60)
textImage = myfont.render("Hello GSTEM", True, white)
# 主循环
while True:
# 事件检测
for event in pygame.event.get():
# 退出游戏
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
screen.fill(blue)
if x < 500:
x = x+0.1
else:
x = 0
screen.blit(textImage, (x, 20))
pygame.display.update()
|