Turtle module

Michael F. Stemper mstemper at gmail.com
Wed May 26 12:57:17 EDT 2021


On 26/05/2021 11.17, Chris Angelico wrote:
> On Thu, May 27, 2021 at 1:59 AM Michael F. Stemper <mstemper at gmail.com> wrote:


>>    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.
>>
>> Similarly, I'd like to return with the pen in the same state
>> (up or down) as when my functions were called. Again, I can't
>> find any way to query the pen state.
>>
>> How can my function get this information? Or do I need to be
>> sloppy and let the callers beware?
> 
> For the most part, this is what you want:
> 
> https://docs.python.org/3/library/turtle.html#turtle.pen

Just found the same thing myself and came back to report it. But,
immediately after your link is:
<https://docs.python.org/3/library/turtle.html#turtle.isdown>
which seems even better for up/down.

> It doesn't seem to include the fullcircle state (which is what
> .degrees() and .radians() set), and I'm not sure why. Worst case, it
> is technically available as the ._fullcircle member, but I would
> advise against using that if you can help it!

Well, I'll take your advice and not use it. Seems really sloppy to
change an attribute of an object as a side-effect, but I guess that
I'll have to be sloppy.

Thanks
-- 
Michael F. Stemper
Deuteronomy 10:18-19


More information about the Python-list mailing list