
""" gameturtle模块旋转模式测试程序。 本程序需要gameturtle0.21版支持。 """ from gameturtle import * root = Tk() root.title('gameturtle旋转模式测试程序') cv = Canvas(width=480,height=360,bg='cyan') cv.pack() frames = [Image.open(f"res/{i}.png") for i in range(16)] cat1 = Sprite(cv,frames,pos=(150,100)) # 默认为360度旋转 cat2 = Sprite(cv,frames,pos=(150,200)) cat2.setrotmode(1) # 设置为左右旋转 cat3 = Sprite(cv,frames,pos=(150,300)) cat3.setrotmode(2) # 设置为不旋转 ft = ('',18,'normal') cv.create_text((300,100),text='360度旋转',font=ft) cv.create_text((300,200),text='左右旋转',font=ft) cv.create_text((300,300),text='不旋转',font=ft) while 1: cat1.left(1);cat1.nextshape() # 左转并换造型 cat2.right(1);cat2.nextshape() # 右转并换造型 cat3.left(1);cat3.nextshape() # 左转并换造型 cv.update() # 更新画布显示 time.sleep(0.01) # 等待0.01秒
本站所有作品,教程等皆为原创,版权所有。只供个人及单位内部研究使用,对外展示或传播必需经本站同意,且注明来自本站。培训机构等用本站资源培训学生,需经本站授权。一旦付款,表示同意本站知识付费原则:数字商品,不支持退款。亦可直接向微信号scratch8付款购买。入住QQ群:225792826 和爱好者共同交流,并且能下载免费提供的Python资源(需提供真实姓名才可入群)
李兴球的博客_Python创意编程技术前沿_pygame » gameturtle模块旋转模式测试程序
李兴球的博客_Python创意编程技术前沿_pygame » gameturtle模块旋转模式测试程序