""" 绕pai的数字合成gif图.py """ from sprites import Screen,Sprite pai = '3.14159265358979323846264338327950288 ' screen = Screen() screen.bgcolor('black') screen.setup(600,600) t = Sprite('blank') t.color('cyan') radius = 200 frames = [] t.bk(radius);t.left(90) ft = ('宋体',38,'normal') for i in range(len(pai)): t.write(pai[i],angle=90-i * 360/len(pai),font=ft) t.circle(-radius,360/len(pai)) frames.append(screen.save()) t.wait(0.1) #for index,frame in enumerate(frames): # frame.save(f'绕pai/{index}.png') # 合成为gif图形 filename = '绕pai.gif' pic = frames[0] pic.save(filename, save_all=True,append_images=frames[1:], optimize=True,quality=80,duration=200,loop=True) screen.mainloop()
李兴球
李兴球的博客是Python创意编程原创博客
要发表评论,您必须先登录。
发表评论