I'm trying to make a pointer(turtle) look at the moving direction, but it doesn't work properly. I debugged it, and it gave me the correct angle, but when i'm trying to turn my turtle to this angle - it doesnt work and turtle is in the same position. Please help me to solve this problem. Here is my code -
import pyautogui as cor
import turtle as pen
from pynput.mouse import Listener
def on_click(x, y, button, pressed):
if pressed:
x, y = cor.position()
print("x =", x, ",", "y =", y)
degree = pen.towards(x, y)
print(degree)
pen.setheading(degree)
pen.goto(x-969, -y+575)
def on_scroll(x, y, dx, dy):
if dy > 0:
print('pen up')
pen.up()
if dy < 0:
print('pen down')
pen.down()
with Listener(on_click=on_click, on_scroll=on_scroll) as listener:
listener.join()