//usr/lib64/lib64//lib64/lib64//ó
§œSec @ s d Z d d l Z d d l m Z m Z d d l m Z d e f d „ ƒ YZ d „ Z e d k r{ e ƒ Z
e
GHe ƒ n d S( sÓ turtle-example-suite:
tdemo_bytedesign.py
An example adapted from the example-suite
of PythonCard's turtle graphcis.
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.
iÿÿÿÿN( t Turtlet mainloop( t clockt Designerc B sY e Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z
RS( c C sî | j ƒ xm t d ƒ D]_ } | j d | ƒ | j ƒ | j | j ƒ | ƒ | j ƒ | j d | ƒ | j d ƒ q W| j ƒ | j | ƒ | j d ƒ | j d | ƒ | j d ƒ | j ƒ | j d | d | ƒ | j
t ƒ d S( Ni gš™™™™)P@iH i$ g €8@iÆ i. gÍÌÌÌÌìa@( t upt ranget forwardt downt wheelt positiont backwardt rightt gotot centerpiecet tracert True( t selft homePost scalet i( ( s4 /usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyt design! s
c C sú | j d ƒ x$ t d ƒ D] } | j | | ƒ q W| j ƒ | j d ƒ x$ t d ƒ D] } | j | | ƒ qX W| j d ƒ xW t d ƒ D]I } | j ƒ | j d ƒ | j d | ƒ | j ƒ | j d | ƒ qŒ W| j d ƒ | j ƒ j
ƒ d S( Ni6 i i$ i iH i ( R R t pentpieceR t leftt tripieceR R R
t getscreent update( R t initposR R ( ( s4 /usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR 3 s
c C sÓ | j ƒ } | j ƒ | j d | ƒ | j d | | ƒ | j ƒ | j | ƒ | j | ƒ | j ƒ | j d | ƒ | j d | | ƒ | j ƒ | j | ƒ | j | ƒ | j d ƒ | j ƒ j
ƒ d S( Ng @g €?@iH ( t headingR R
t tripolyrR R t
setheadingt tripolylR R R ( R R R t oldh( ( s4 /usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR E s
c C sM | j ƒ } | j ƒ | j d | ƒ | j ƒ x2 t d ƒ D]$ } | j d | ƒ | j d ƒ q> W| j d | d | ƒ | j ƒ | j | ƒ | j | ƒ | j d | ƒ | j ƒ x2 t d ƒ D]$ } | j d | ƒ | j d ƒ qÉ W| j d | d | ƒ | j ƒ | j | ƒ | j | ƒ | j
d ƒ | j ƒ j ƒ d S( Ni i i iH iK (
R R R R R R t pentrR R t pentlR R R ( R R R R R ( ( s4 /usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR V s,
c C sM | d | k r d S| j | ƒ | j | ƒ | j | d | | | ƒ d S( Ni gR¸…ëQØ?( R R R! ( R t sidet angR ( ( s4 /usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR! n s
c C sM | d | k r d S| j | ƒ | j | ƒ | j | d | | | ƒ d S( Ni gR¸…ëQØ?( R R R ( R R" R# R ( ( s4 /usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR t s
c C s‚ | d | k r d S| j | ƒ | j d ƒ | j | d ƒ | j d ƒ | j | d ƒ | j d ƒ | j | d | ƒ d S( Ni io g{®Gázü?gÍÌÌÌÌÌô?i’ g è?( R R R ( R R" R ( ( s4 /usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR z s
c C s‚ | d | k r d S| j | ƒ | j d ƒ | j | d ƒ | j d ƒ | j | d ƒ | j d ƒ | j | d | ƒ d S( Ni io g{®Gázü?gÍÌÌÌÌÌô?i’ g è?( R R R ( R R" R ( ( s4 /usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR „ s
c C sM | j | ƒ | j | ƒ | d | k r. d S| j | d | | | ƒ d S( Ng @g333333ó?( R R R
( R t st aR ( ( s4 /usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR
Ž s
( t __name__t
__module__R R R R R! R R R R
( ( ( s4 /usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR s
c C st t ƒ } | j d ƒ | j ƒ | j ƒ j d ƒ | j d ƒ t ƒ } | j | j ƒ d ƒ t ƒ } d | | S( Ni i s runtime: %.2f sec.( R t speedt
hideturtleR t delayR R R R ( t tt att et( ( s4 /usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyt main” s
t __main__( t __doc__t matht turtleR R t timeR R R. R&