Turtle module

boB Stepp robertvstepp at gmail.com
Wed May 26 19:28:57 EDT 2021


On Wed, May 26, 2021 at 10:59 AM Michael F. Stemper <mstemper at gmail.com> wrote:

> In order to turn the turtle, I need to select a way to represent
> angles. I could use either degrees or radians (or, I suppose,
> grads). However, for my functions to work, I need to set the
> turtle to that mode. This means that I could possibly mess up
> things for the caller. What I would like to do is capture the
> angle-representation mode on entry and restore it on return.
> However, looking through the methods of turtle.Turtle(), I
> can't find any means of capturing this information

In the "Tell Turtle's state" section
(https://docs.python.org/3/library/turtle.html#tell-turtle-s-state) I
would think that you could roll your own function by using your
knowledge of the coordinates of where the turtle is at and the
turtle.towards(0, 0).  By computing your own angle (knowing what units
you are using) and comparing with what is returned you should be able
to determine what angular units are currently set.

HTH!
boB Stepp


More information about the Python-list mailing list