Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/turtledemo/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/turtledemo/__pycache__/bytedesign.cpython-35.opt-1.pyc



��Yf��@s�dZddlZddlmZmZddlmZGdd�de�Zdd�Ze	d	kr�e�Z
ee
�e�dS)
a�      turtle-example-suite:

        tdemo_bytedesign.py

An example adapted from the example-suite
of PythonCard's turtle graphics.

It's based on an article in BYTE magazine
Problem Solving with Logo: Using Turtle
Graphics to Redraw a Design
November 1982, p. 118 - 134

-------------------------------------------

Due to the statement

t.delay(0)

in line 152, which sets the animation delay
to 0, this animation runs in "line per line"
mode as fast as possible.
�N)�Turtle�mainloop)�clockc@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�DesignercCs�|j�xmtd�D]_}|jd|�|j�|j|j�|�|j�|jd|�|jd�qW|j�|j|�|jd�|jd|�|jd�|j�|j	d|d|�|j
�jd	�dS)
N�g�����)P@�H�$g�8@���.g������a@T)�up�range�forward�down�wheel�position�backward�right�goto�centerpiece�	getscreen�tracer)�selfZhomePos�scale�i�r�:/opt/alt/python35/lib64/python3.5/turtledemo/bytedesign.py�design!s 







zDesigner.designcCs�|jd�x$td�D]}|j||�qW|j�|jd�x$td�D]}|j||�qXW|jd�xWtd�D]I}|j�|jd�|jd|�|j�|jd|�q�W|jd�|j	�j
�dS)N�6�rrr�)rr�	pentpiecer�left�tripiecer
rrr�update)r�initposrrrrrr3s 







zDesigner.wheelcCs�|j�}|j�|jd|�|jd||�|j�|j|�|j|�|j�|jd|�|jd||�|j�|j|�|j|�|jd�|j	�j
�dS)Ng@g�?@r)�headingrr�tripolyrrr�
setheading�tripolylr!rr#)rr$r�oldhrrrr"Es








zDesigner.tripiececCsM|j�}|j�|jd|�|j�x2td�D]$}|jd|�|jd�q>W|jd|d|�|j�|j|�|j|�|jd|�|j�x2td�D]$}|jd|�|jd�q�W|j	d|d|�|j�|j|�|j|�|j
d�|j�j�dS)N�r�r�K)
r%rr
rrr�pentrrr'�pentlr!rr#)rr$rr)rrrrr Vs,









zDesigner.pentpiececCsM|d|krdS|j|�|j|�|j|d|||�dS)N�gR���Q�?)r
r!r.)r�side�angrrrrr.ns


zDesigner.pentlcCsM|d|krdS|j|�|j|�|j|d|||�dS)Nr/gR���Q�?)r
rr-)rr0r1rrrrr-ts


zDesigner.pentrcCs�|d|krdS|j|�|jd�|j|d�|jd�|j|d�|jd�|j|d|�dS)Nr�og{�G�z�?g�������?�g�?)r
rr&)rr0rrrrr&zs



zDesigner.tripolyrcCs�|d|krdS|j|�|jd�|j|d�|jd�|j|d�|jd�|j|d|�dS)Nrr2g{�G�z�?g�������?r3g�?)r
r!r()rr0rrrrr(�s



zDesigner.tripolylcCsM|j|�|j|�|d|kr.dS|j|d|||�dS)Ng@g333333�?)r
r!r)r�s�arrrrr�s


zDesigner.centerpieceN)�__name__�
__module__�__qualname__rrr"r r.r-r&r(rrrrrrs

rcCszt�}|jd�|j�|j�jd�|j�jd�t�}|j|j�d�t�}d||S)Nrr/zruntime: %.2f sec.)	rZspeedZ
hideturtlerZdelayrrrr)�tZatZetrrr�main�s	

		r:�__main__)�__doc__ZmathZturtlerrZtimerrr:r6�msg�printrrrr�<module>su