from sprites import * bug = Sprite() while True: pmx,pmy = pmouse_pos() # 获取先前鼠标指针 mx,my = mouse_pos() # 获取鼠标指针 bug.heading((mx,my)) if bug.distance(mx,my)>50: bug.fd(1) print(mx-pmx,my-pmy) bug.update()