def linear(control,ix,iy, tox,toy,speed): if (tox - ix): m = (toy - iy)/float((tox - ix)) b = iy - (m * ix) else: m = 0 x = ix y = iy if m: if tox < ix: while not x == tox: if y != toy: x -= speed y = (m * x) + b control.setPosition(x,y) sleep(0.08) else: while not x == tox: if y != toy: x += speed y = (m * x) + b control.setPosition(x,y) sleep(0.08) else: if y > toy: while y > toy: x = ix y -= speed control.setPosition(x,y) sleep(0.08) else: while toy < y: x = ix y += speed control.setPosition(x,y) sleep(0.08)