python 跑動的中文字幕製作如下:
# pygame 跑動字幕
# Python 3.X
import pygame
from pygame.locals import *
white = 255,255,255
blue = 0,0,200
pos_x = 300
pos_y = 250
vel_x = 0.2
vel_y =0.1
pygame.init()
screen = pygame.display.set_mode((600,500))
myfont = pygame.font.Font('c:/Windows/fonts/simhei.ttf',60)
textImage = myfont.render("你好,中國", True, white)
while True:
for event in pygame.event.get():
if event.type in (QUIT, KEYDOWN):
sys.exit()
pos_x += vel_x
pos_y += vel_y
if pos_x > 330 or pos_x < 0:
vel_x = -vel_x
if pos_y > 440 or pos_y < 0:
vel_y = -vel_y
pos = pos_x, pos_y, 100, 100
screen.fill(blue)
screen.blit(textImage, pos)
pygame.display.update()
運行