ó Afc@sdZddlZddlmZmZddlmZdefd„ƒYZd„Ze dkr{eƒZ e GHeƒndS( 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(tTurtletmainloop(tclocktDesignercBsYeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( cCsî|jƒxmtdƒD]_}|jd|ƒ|jƒ|j|jƒ|ƒ|jƒ|jd|ƒ|jdƒqW|jƒ|j|ƒ|jdƒ|jd|ƒ|jdƒ|jƒ|j d|d|ƒ|j t ƒdS( Nigš™™™™)P@iHi$g€8@iÆi.gÍÌÌÌÌìa@( tuptrangetforwardtdowntwheeltpositiontbackwardtrighttgotot centerpiecettracertTrue(tselfthomePostscaleti((s4/usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pytdesign!s         cCsú|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(Ni6ii$iiHi( R Rt pentpieceRtleftttripieceRRR t getscreentupdate(RtinitposRR((s4/usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR3s         cCsÓ|jƒ}|jƒ|jd|ƒ|jd||ƒ|jƒ|j|ƒ|j|ƒ|jƒ|jd|ƒ|jd||ƒ|jƒ|j|ƒ|j|ƒ|jdƒ|j ƒj ƒdS(Ng@g€?@iH( theadingRR ttripolyrRR t setheadingttripolylRRR(RRRtoldh((s4/usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyREs          cCsM|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(NiiiiHiK( RRRRRR tpentrR RtpentlRRR(RRRRR((s4/usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyRVs,           cCsM|d|krdS|j|ƒ|j|ƒ|j|d|||ƒdS(NigR¸…ëQØ?(RRR!(RtsidetangR((s4/usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR!ns   cCsM|d|krdS|j|ƒ|j|ƒ|j|d|||ƒdS(NigR¸…ëQØ?(RR R (RR"R#R((s4/usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR ts   cCs‚|d|krdS|j|ƒ|jdƒ|j|dƒ|jdƒ|j|dƒ|jdƒ|j|d|ƒdS(Niiog{®Gázü?gÍÌÌÌÌÌô?i’gè?(RR R(RR"R((s4/usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyRzs    cCs‚|d|krdS|j|ƒ|jdƒ|j|dƒ|jdƒ|j|dƒ|jdƒ|j|d|ƒdS(Niiog{®Gázü?gÍÌÌÌÌÌô?i’gè?(RRR(RR"R((s4/usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR„s    cCsM|j|ƒ|j|ƒ|d|kr.dS|j|d|||ƒdS(Ng@g333333ó?(RRR (RtstaR((s4/usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyR Žs  ( t__name__t __module__RRRRR!R RRR (((s4/usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyRs       cCsttƒ}|jdƒ|jƒ|jƒjdƒ|jdƒtƒ}|j|jƒdƒtƒ}d||S(Niisruntime: %.2f sec.( Rtspeedt hideturtleRtdelayRRRR (tttattet((s4/usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pytmain”s      t__main__( t__doc__tmathtturtleRRttimeRRR.R&tmsg(((s4/usr/lib64/python2.7/Demo/turtle/tdemo_bytedesign.pyts u