Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
> the program is supposed to draw a function like y=sin(x) but is drawing > y=abs(sin(x)). It would have been nice if you had described the problem this way from your initial bug report, instead of saying that the turtle was moving backwards. I understood "moving backwards" as it going back over its own path, retracing its steps. I wasted a lot of time peering carefully at the screen trying to see where the turtle was retracing its steps. Now I understand you mean the turtle is moving in the opposite direction from that it is facing. Gotcha. You titled this bug report "Turtle demo", but I can't find it listed in the turtle demo here: https://docs.python.org/3/library/turtle.html#module-turtledemo Where did you get this demo from? If it's not from the standard library, you should report this to the author, as it is a bug in their code, not the turtle module, caused by mishandling of negative numbers. If you move *forward* by a *negative* amount, of course you are going in the opposite direction to that you are facing. So the spike() function is buggy. There are probably many ways to fix it, depending on what you intend it to do, but probably the simplest is to just add a call to abs() before calling forward: james.forward(abs(int(d*100))) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40113> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com