| Server IP : 121.121.20.254 / Your IP : 216.73.217.51 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Python315/Lib/__pycache__/ |
Upload File : |
R
>lqjZ c � � Q s ] PHs] PHs] PHs] PHs] PHs] PHs] QH G s G
s
Gs ] QH0G
s
] QH8Gs ] QH@Gs ] QHGs , Q�Ns, QMQ
MQMQMQMQMQMQMQMQMQMQMQMQMQMQMQMQMQMQMQ MQ!MQ"MQ#MQ$MQ%MQ&MQ'MQ(MQ)MQ*MQ+MQ,Ms, Q-MQ.MQ/MQ0MQ1MQ2MQ3MQ4MQ5MQ6MQ7MQ8MQ9MQ:MQ;MQ<MQ=MQ>MQ?MQ@MQAMQBMQCMQDMQEMQFMQGMQHMQIMQJMQKMQLMQMMQNMQOMQPMQQMQRMQSMQTMQUMQVMQWMQXMQYMQZMQ[MQ\MQ]MQ^MQ_MQ`MQaMQbMQcMQdMQeMQfMQgMQhMQiMQjMQkMQlMQmMQnMQoMQpMQqMQrMQsMQtMQuMQvMQwMQxMQyMQzMQ{MQ|MQ}MsQ~Q,s\\* \* \* Q�,* s, Q�Ns- QzQ�aQ�Q�aQ�Q�aQ�Q�aQ�PaQ�PaQQ�aQQ�aQ]
aQ�Q�aQjQ�aQVQ�aQ?Q�aQaQ�aQ�P aQ�Q�aQ�Q�aQ�Q�Q'Q�Q�P
-AsQ� sQ� s \ \2 Q� Q\2 sQ� s Q� s!Q�s"Q�Q� ks# Q� Q\OH 2 s%\# \%\OL Q�2 Q� Q�\ON 2 s(\OL s& Q� Q�\)2 s* Q� Q�\2 s+ Q� Q�\2 s, Q� Q
\)2 s- Q� Q�\)2 s. Q� Q\*2 s/ Q� Q�\)2 s0 Q� Q�\)2 s1 Q� Q�\)2 s2 Q� Q\1\02 s3\3s4Q� s5 Q� Q�\/2 s6 Q� Q \32 s7\7s8Q�Q� ks9Q� s:\Q�* s; \;Q�6w c \: \;2 Q� s=Q� s>Q� s?Q�s@Q� sA\A \\6Q�Q�\?2 \A \\7Q�Q�\>2 \BsC\DQ�6X c! Q� sEQ� sFQ� sG\F 2 \G 2 \H 2 P! P! \ c
\ Q�2 CKrh 9 h \< c
\ Q�\;2 Ky\ c \ Q�\;* 2 K�h 9 h)�a�
Turtle graphics is a popular way for introducing programming to
kids. It was part of the original Logo programming language developed
by Wally Feurzig and Seymour Papert in 1966.
Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an ``import turtle``, give it
the command turtle.forward(15), and it moves (on-screen!) 15 pixels in
the direction it is facing, drawing a line as it moves. Give it the
command turtle.right(25), and it rotates in-place 25 degrees clockwise.
By combining together these and similar commands, intricate shapes and
pictures can easily be drawn.
----- turtle.py
This module is an extended reimplementation of turtle.py from the
Python standard distribution up to Python 2.5. (See: https://www.python.org)
It tries to keep the merits of turtle.py and to be (nearly) 100%
compatible with it. This means in the first place to enable the
learning programmer to use all the commands, classes and methods
interactively when using the module from within IDLE run with
the -n switch.
Roughly it has the following features added:
- Better animation of the turtle movements, especially of turning the
turtle. So the turtles can more easily be used as a visual feedback
instrument by the (beginning) programmer.
- Different turtle shapes, image files as turtle shapes, user defined
and user controllable turtle shapes, among them compound
(multicolored) shapes. Turtle shapes can be stretched and tilted, which
makes turtles very versatile geometrical objects.
- Fine control over turtle movement and screen updates via delay(),
and enhanced tracer() and speed() methods.
- Aliases for the most commonly used commands, like fd for forward etc.,
following the early Logo traditions. This reduces the boring work of
typing long sequences of commands, which often occur in a natural way
when kids try to program fancy pictures on their first encounter with
turtle graphics.
- Turtles now have an undo()-method with configurable undo-buffer.
- Some simple commands/methods for creating event driven programs
(mouse-, key-, timer-events). Especially useful for programming games.
- A scrollable Canvas class. The default scrollable Canvas can be
extended interactively as needed while playing around with the turtle(s).
- A TurtleScreen class with methods controlling background color or
background image, window and canvas size and other properties of the
TurtleScreen.
- There is a method, setworldcoordinates(), to install a user defined
coordinate-system for the TurtleScreen.
- The implementation uses a 2-vector class named Vec2D, derived from tuple.
This class is public, so it can be imported by the application programmer,
which makes certain types of computations very natural and compact.
- Appearance of the TurtleScreen and the Turtles at startup/import can be
configured by means of a turtle.cfg configuration file.
The default configuration mimics the appearance of the old turtle module.
- If configured appropriately the module reads in docstrings from a docstring
dictionary in some different language, supplied separately and replaces
the English ones by those read in. There is a utility function
write_docstringdict() to write a dictionary with the original (English)
docstrings to disc, so it can serve as a template for translations.
Behind the scenes there are some features included with possible
extensions in mind. These will be commented and documented elsewhere.
)�isfile�split�join)�Path)�contextmanager)�deepcopy)�simpledialog�ScrolledCanvas�TurtleScreen� RawTurtle�Turtle�Shape�Vec2D�addshape�bgcolor�bgpic�bye�clearscreen� colormode�delay�exitonclick� getcanvas� getshapes�listen�mainloop�mode�no_animation�numinput�onkey�
onkeypress�onkeyrelease�
onscreenclick�ontimer�register_shape�resetscreen�
screensize�save�setup�setworldcoordinates� textinput�title�tracer�turtles�update�
window_height�window_width�back�backward�
begin_fill�
begin_poly�bk�circle�clear�
clearstamp�clearstamps�clone�color�degrees�distance�dot�down�end_fill�end_poly�fd� fillcolor�fill�filling�forward�get_poly�getpen� getscreen�
get_shapepoly� getturtle�goto�heading�
hideturtle�home�ht�isdown� isvisible�left�lt�onclick�ondrag� onrelease�pd�pen�pencolor�pendown�pensize�penup�poly�pos�position�pu�radians�right�reset�
resizemode�rt�seth�
setheading�setpos�setposition�
setundobuffer�setx�sety�shape� shapesize�shapetransform�shearfactor�
showturtle�speed�st�stamp�teleport�tilt� tiltangle�towards�
turtlesize�undo�undobufferentries�up�width�write�xcor�ycor�write_docstringdict�done�
Terminator� �?�heightg �?� canvwidth� �
canvheight�, � leftright� topbottom�standard� �?�undobuffersize�� �classic�black�noresize�visible�language�english�
exampleturtle�turtle�
examplescreen�screenzPython Turtle Graphics�
using_IDLEc �D � [ U Q2 9^tt^ 2 oUO 2 oPPP2 - oWF D� oUO 2 oU% c UO Q2 % c J4 UO Q2 v qVUO 2 oUO 2 oUQ7 c
[ U2 oL QU7 c
[ U2 oL[ U2 o VcU$ J� U! ) % f h K�9 h [
c [
QS 8 QS8 02 J� h 9 h [
c KOh 9 h)z/Convert content of config-file into dictionary.�r�#�=zBad line in config-file z:
�.)�True�False�Nonez''z"")
�open� readlines�strip�
startswithr �
ValueError�print�eval�float�int)�filename�f�cfglines�cfgdict�line�key�values & �C:\Python315\\Lib\turtle.py�config_dictr� � s� � �
�h�� � ���;�;�=��
��G����z�z�|���t���s�+�+�� ����C��J�C� �i�i�k�����
���9�9���K�E�
��%�<�!�%�L�E���J�E� ���+ �, �N�3
� �� � ��x��E�F�� �� �
��
�sM �C�)C,�0D�7D�D�C) �"C) �, D�6D�
D� D�D�Dc �f � Qo- o- o[ U2 % c [ U2 oQU7 c QUQ* * o [ [ 2 v qE[ VA2 o[ U2 % c [ U2 o[ O U2 [ O U2 P! [
c Po KWh 9 h)a Read config-files, change configuration-dict accordingly.
If there is a turtle.cfg file in the current working directory,
read it from there. If this contains an importconfig-value,
say 'myway', construct filename turtle_mayway.cfg else use
turtle.cfg and read it from the import-directory, where
turtle.py is located.
Update configuration dictionary first according to config-file,
in the import directory, then according to config-file in the
current working directory.
If no config-file is found, the default configuration is used.
z
turtle.cfg�importconfigz
turtle_%s.cfg)r r� r �__file__r � Exception�_CFGr, )r� �default_cfg�cfgdict1�cfgdict2�head�tail� cfg_file2s & r� �
readconfigr� � s� � � �K��H��H�
�k����{�+����!�%���(@�@����8�_�
����+� � �i����y�)���K�K����K�K���� � �� ��s �B � B0�*B0�/B0z"No configfile read, reason unknownc �b ` � \ sQ s]�s n QsQ sQ sQ sQ sQ s Q s
Q sQ sQ
s
Q sQsU sP! )
r
a� A 2 dimensional vector class, used as a helper class
for implementing turtle graphics.
May be useful for turtle graphics programs also.
Derived from tuple, so a vector is a tuple!
Provides (for a, b vectors, k number):
a+b vector addition
a-b vector subtraction
a*b inner product
k*a and a*k multiplication with scalar
|a| absolute value of a
a.rotate(angle) rotation
c �2 � [ O VU12 ! �N)�tuple�__new__)�cls�x�ys &&&r� r� �
Vec2D.__new__� s � ��}�}�S�a�&�)�)� c �p � [ U ] * U] * * U ]* U]* * 2 ! �� �r
��self�others &&r� �__add__�
Vec2D.__add__� �) � ��T�!�W�U�1�X�%�t�A�w�u�Q�x�'7�8�8r� c �� � [ U[ 2 % c4 U ] * U] * * U ]* U]* * * ! [ U ] * U* U ]* U* 2 ! r� )�
isinstancer
r� s &&r� �__mul__�
Vec2D.__mul__� sQ � ��e�U�#�#���7�5��8�#�D��G�E�!�H�$4�4�4��T�!�W�U�]�D��G�E�M�2�2r� c � � [ U[ 2 % f [ U[ 2 % c) [ U ] * U* U ]* U* 2 ! [ ! r� )r� r� r� r
�NotImplementedr� s &&r� �__rmul__�Vec2D.__rmul__� s>