
""" Python海龟画图画版2020617版 """ import turtle screen = turtle.getscreen() screen.setup(480,360) screen.bgcolor('black') screen.delay(0) turtle.color('magenta') turtle.speed(0) turtle.penup() turtle.ht() last_pos = None def begindraw(event): global last_pos x = event.x - 240 # 转换成海龟坐标系中的x坐标 y = 180 - event.y # 转换成海龟坐标系中的y坐标 if last_pos is not None: turtle.goto(last_pos) turtle.pendown() turtle.goto(x,y) def enddraw(event): turtle.penup() last_pos = None pass # 这里省略了若干代码...... screen.mainloop()
需要所有源代码,请扫码付款:
本站所有作品,教程等皆为原创,版权所有。只供个人及单位内部研究使用,对外展示或传播必需经本站同意,且注明来自本站。培训机构等用本站资源培训学生,需经本站授权。一旦付款,表示同意本站知识付费原则:数字商品,不支持退款。亦可直接向微信号scratch8付款购买。入住QQ群:225792826 和爱好者共同交流,并且能下载免费提供的Python资源(需提供真实姓名才可入群)
李兴球的博客_Python创意编程技术前沿_pygame » Python海龟画图画板2020617版
李兴球的博客_Python创意编程技术前沿_pygame » Python海龟画图画板2020617版