"""
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即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)

