#第一步:生成数据图片,当然方法很多,这里用pygame来做图片(字体为电脑中有效中文字体。),图片规格为2000, 1000,每个汉字的#规格为40*40,实践汉字为“东西南北中”
import pygame
import random
pygame.init()
screen = pygame.display.set_mode((2000, 1000))
font_list = [‘microsoftjhenghei’, ‘microsoftyahei’,
‘mingliupmingliumingliuhkscs’, ‘simsunnsimsun’,
‘fangsong’, ‘simhei’, ‘kaiti’, ‘dfkaisb’, ‘fzshuti’,
‘fzyaoti’, ‘lisu’, ‘stcaiyun’, ‘stfangsong’,
‘sthupo’, ‘stkaiti’, ‘stliti’, ‘stsong’, ‘stxihei’,
‘stxingkai’, ‘stxinwei’, ‘stzhongsong’, ‘youyuan’, ‘arialms’]
Chinese = [‘东’,‘西’,‘南’,‘北’, ‘中’]
def getText(font, charactor, x, y):
font = pygame.font.SysFont(font, 30)
surf = font.render(charactor, True, (255, 255, 255))
rect = surf.get_rect()
rect.midtop = (x, y)
screen.blit(surf, rect)
def write():
i = 0
x = 20
y = 0
while i