h dZddlZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z ddl mZddlmZgdZgdZgdZd d gZeezezezd gzZgd Zid ddddddddddddddddddddd d!d"d#d"d$d%d&d'd(d)d*d+d,d-d.d/Zd0Zd1Z een#e$red2YnwxYwGd3d4eZd5Zd6Zd7Zdid9Z Gd:d;ej!Z"e e"ej#d<Gd=d>ej$Z%ej#Z#Gd?d@e&Z'GdAd eZ(GdBdCeZ)GdDdEe&Z*GdFdGe&Z+GdHdIe'Z,GdJdKe&Z-GdLdMe&Z.GdNdOe&Z/GdPdQe.e-Z0e0Z1dRZ2GdSdTe,Z3GdUdVe0Z4e4Z5djdXZ6dYZ7ed(Z8 e8d)kr e7e8n+#e9$redZe8Yne$red[e8zYnwxYwd\Z:d]Z;d^Ze>ee3dadbe<e>ee4dcdde;e?Z@eAdekr)dfZBdgZCdhZDeCeDeEdSdS)kz-turtle 1.1b- - for Python 3.1 - 4. 5. 2009N)isfilesplitjoin)deepcopy) simpledialog) ScrolledCanvas TurtleScreenScreen RawTurtleTurtleRawPenPenShapeVec2D)addshapebgcolorbgpicbye clearscreen colormodedelay exitonclick getcanvas getshapeslistenmainloopmodenuminputonkey onkeypress onkeyrelease onscreenclickontimerregister_shape resetscreen screensizesetupsetworldcoordinates textinputtitletracerturtlesupdate window_height window_width)Obackbackward begin_fill begin_polybkcircleclear clearstamp clearstampsclonecolordegreesdistancedotdownend_fillend_polyfd fillcolorfillingforwardget_polygetpen getscreen get_shapepoly getturtlegotoheading hideturtlehomehtisdown isvisibleleftltonclickondrag onreleasepdpenpencolorpendownpensizepenuppospositionpuradiansrightreset resizemodertseth setheadingsetpos setposition settiltangle setundobuffersetxsetyshape shapesizeshapetransform shearfactor showturtlespeedststamptilt tiltangletowards turtlesizeundoundobufferentriesupwidthwritexcorycorwrite_docstringdictdone Terminator)rr1r4rArNrRrVr\r^rcrdrfrgrrrwrzr{r{?heightg? canvwidthi canvheighti, leftright topbottomrstandardr?r undobuffersizeirlclassicrXblackrBrbnoresizevisibleTlanguageenglish exampleturtleturtlescreenzPython Turtle GraphicsF) examplescreenr* using_IDLEcP t|d5}|}dddn #1swxYwYi}|D]}|}|r|dr. |d\}}n%#t $rt d|d|YiwxYw|}|}|dvrt|}n5 d|vrt|}nt|}n#t $rYnwxYw|||<|S)Nr#=zBad line in config-file z: )TrueFalseNonez''z"".) open readlinesstrip startswithr ValueErrorprintevalfloatint)filenamefcfglinescfgdictlinekeyvalues +/opt/alt/python311/lib/python3.11/turtle.py config_dictrs9 h  !;;==!!!!!!!!!!!!!!!Gzz|| ts++   CJC    ExxxE F F F H iikk  9 9 9KKEE %<<!%LLEEJJE     Ns03771B  B,+B,,#D DDc d}i}i}t|rt|}d|vr d|dz} tt\}}t ||}n#t $rd}YnwxYwt|rt|}t |t |dS)Nz turtle.cfg importconfigz turtle_%s.cfg)rrr__file__r Exception_CFGr-)r default_cfgcfgdict1cfgdict2headtail cfg_file2s r readconfigrs KHH k,{++!!%(@@ 8__ d{++   i*y))KKKKs'A A-,A-z"No configfile read, reason unknowncLeZdZ dZdZdZdZdZdZdZ dZ d Z d Z d S) rc<t|||fSN)tuple__new__)clsxys rrz Vec2D.__new__s}}S1a&)))c^t|d|dz|d|dzSNrrselfothers r__add__z Vec2D.__add__,T!WU1X%tAwuQx'7888rct|tr#|d|dz|d|dzzSt|d|z|d|zSr) isinstancerrs r__mul__z Vec2D.__mul__sY eU # # 5758#DGE!H$44 4T!WU]DGEM222rct|tst|tr"t|d|z|d|zStSr)rrrrNotImplementedrs r__rmul__zVec2D.__rmul__sK eS ! ! 7Zu%=%= 7aQ 66 6rc^t|d|dz |d|dz Srrrs r__sub__z Vec2D.__sub__rrc>t|d |d Srrrs r__neg__z Vec2D.__neg__ sd1gXQx(((rctj|Sr)mathhypotrs r__abs__z Vec2D.__abs__ sz4  rc* t|d |d}tj|}tj|tj|}}t|d|z|d|zz|d|z|d|zzS)Nrr)rrr_cossin)rangleperpcss rrotatez Vec2D.rotate s d1gXtAw'' U##x1T!WQYtAwqy($q'!)DGAI*=>>>rc"|d|dfSrrs r__getnewargs__zVec2D.__getnewargs__sQa!!rc d|zS)Nz (%.2f,%.2f)rrs r__repr__zVec2D.__repr__s t##rN) __name__ __module__ __qualname__rrrrrrrrrrrrrrrs ***999333999)))!!!???"""$$$$$rrc t|j}||D]}t|||jD]'\}}t |tjkr|||<(dSr) list __bases__reverse __methodDict__dict__itemstypetypes FunctionType)r_dictbaseList_superrrs rrr"s-CM""H $$VU####l((** U ;;%, , ,E#JrcP i}t|||Sr)rkeys)rrs r __methodsr,s(- Ee ::<<rzTdef %(method)s(self, *args, **kw): return self.%(attribute)s.%(method)s(*args, **kw)rci}t||i}t|}|D]2}|dddks|dddks||vs||vr'||||<3|D]S\}} || d} t |t r t ||dz} t| | t||| |TdS)Nr_)methodfunc)r attribute) rrrrrstr __stringBodyexecsetattr) fromClasstoClasstoPartexclude_dict_1rmfcexrrd execStrings r__forwardmethodsr6sG'""" E I  Cllnn$$ bqb6S==BrssGsNNbGmmrSyy  E"II .. t , , fc " " I6HHH  Z 61V9---- ..rcTeZdZ ddZddZdZdZd Zd Zd Z d Z d Z dZ dS)r^Xc tj||||||_||c|_|_||c|_|_d|_ tj ||||j tj d|_ tj ||j jtj|_tj ||j j|_|j |jj|jj|dd d |dd d |j d |d ddd d d |jd |d dd d d d |jd |d d dd d d ||jd |jdS)N)r{rwhite)r{rbgrelief borderwidth)commandorient)r)xscrollcommandyscrollcommandrr)weightminsizenewspadxin_padyrowcolumnrowspan columnspanstickyz )TKFrame__init__winfo_toplevel _rootwindowr{rrrrCanvasSUNKEN_canvas Scrollbarxview HORIZONTALhscrollyviewvscroll configureset rowconfigurecolumnconfiguregridrabindonResize)rmasterr{rrrs rr/zScrolledCanvas.__init__Qs $eFCCC..00"' DK*3Z'yuV$(GBI1NNN |FDL4F+-=::: |FDL4FGGG  dl.>.2l.>  @ @ @ !Aq111 Qq!444 q1!!&  B B B q1!!&  B B B q1!!&  B B B  mT];;;;;rNc |r||_|r||_|r||_|j||j dz|j dz|jdz|jdzf|jd|j|jz dzz|jz |jd|j|jz dzz|jz | dS)Nr)r scrollregionr) rrrr4config xview_movetor{ yview_movetor adjustScrollsrrrrs rrazScrolledCanvas.resetjsJ  '&DN  )(DO  DG r'+~oq&84?:JA:M'+~q'8$/1:L&N  O O O !!#t~ 'BR'G"H?C~#N O O O !!#t 'Cb'H"I>Bo#N O O O rc < |j}|j}|jd|j|z z|jz |jd|j|z z|jz ||jks ||jkrF|jd|dddddd|j d|dddddddS|j |j dS)Nrrrr#r$) r4 winfo_width winfo_heightrGrrHrr8r?r: grid_forget)rcwidthcheights rrIzScrolledCanvas.adjustScrolls|s: ))++,++-- !!#t~f'<"=dn"LMMM !!#tw'>"?"OPPP DN " "g&?&? L  1Dqa%&a  P P P L  1Dqa%&a  P P P P P L $ $ & & & L $ $ & & & & &rc0 |dSr)rI)revents rrAzScrolledCanvas.onResizes rc" |jj|Sr)r4bboxrargss rrTzScrolledCanvas.bboxs  t| $''rc( |jj|i|Sr)r4cgetrrVkwargss rrXzScrolledCanvas.cgets!  t| $1&111rc, |jj|i|dSr)r4rFrYs rrFzScrolledCanvas.config'  T,V,,,,,rc, |jj|i|dSr)r4r@rYs rr@zScrolledCanvas.binds'  4*6*****rc, |jj|i|dSr)r4unbindrYs rr_zScrolledCanvas.unbindr\rc: |jdSr)r4 focus_forcers rrazScrolledCanvas.focus_forces!    """""r)rrrrNNN) rrrr/rarIrArTrXrFr@r_rarrrrrKs 25DG<<<<2$''' ((( 222 --- +++ --- #####rrr4c:eZdZ dZdZdZdZdZdZdZ dS) _RootcDtj|dSr)r-Tkr/rs rr/z_Root.__init__s trcnt||||||_|jdddS)Nrboth)expandfill)rr4pack)rr{rrOrPs r setupcanvasz_Root.setupcanvass:%dE667KK  00000rc|jSr)r4rs r _getcanvasz_Root._getcanvass |rc>|d||||fzdS)Nz %dx%d%+d%+d)geometry)rr{rstartxstartys r set_geometryz_Root.set_geometrys( mUFFF$CCDDDDDrc2|d|dS)NWM_DELETE_WINDOW) wm_protocol)rdestroys r ondestroyz_Root.ondestroys +W55555rc*|Sr)winfo_screenwidthrs r win_widthz_Root.win_widths%%'''rc*|Sr)winfo_screenheightrs r win_heightz_Root.win_heights&&(((rN) rrrr/rlrnrsrxr{r~rrrrdrds1111EEE666((()))))rrdceZdZ dZdZdZdZ d%dZdZ d%d Z d Z d Z d Z d Z d&dZdZd'dZd'dZd'dZd'dZdZd&dZdZdZdZdZdZdZdZdZdZd(d Zd!Z d"Z!d#Z"d(d$Z#dS))TurtleScreenBasech tjdd|j}||S)Nr)r{rrB)r- PhotoImagecvblank)rimgs r _blankimagezTurtleScreenBase._blankimages1 m!Adg>>>  rc: tj||jS)N)filerB)r-rr)rrs r_imagezTurtleScreenBase._images  }(47;;;;rc||_t|tr|jj}|jj}n{t |jd}t |jd}|j| dz| dz|dz|dzf||_||_dx|_|_ dS)Nr{rrrDr) rrrrrrrXrFxscaleyscale)rrwhs rr/zTurtleScreenBase.__init__s b. ) ) G!A"AADGLL))**ADGLL**++A GNNA2q51"a%Aq!t*EN F F F$'' dkkkrc> |jdddS)N)rrrrrrrrjoutline)rcreate_polygonrs r _createpolyzTurtleScreenBase._createpolys% w%%&8r2%NNNrNFc g}|D]@\}} |||jz|| |jzA|jj|g|R||j||||j||||j|||r|j|dSdS)Nrj)rr{appendrrrcoords itemconfigure tag_raise) rpolyitem coordlistrjrr{topclrrs r _drawpolyzTurtleScreenBase._drawpolys  ( (DAq IIa$+o & & & IIqb4;& ' ' ' 'x%"%%%%   G ! !( ! 6 6 6   G ! !(G ! < < <   G ! !(% ! 8 8 8  ( G  h ' ' ' ' ' ( (rc Z |jddddddtjS)Nrrr)rjr{capstyle)r create_liner-ROUNDrs r _createlinezTurtleScreenBase._createline s7 w""1aABa.0h#88 8rcp |Xg}|D]@\}}|||jz|| |jzA|jj|g|R||j||||j|||r|j|dSdS)Nrrr) rlineitemrrjr{rrrrs r _drawlinezTurtleScreenBase._drawlines   B! , ,1 !dk/*** 1"t{*++++ DGN8 )b ) ) ) )   G ! !( ! 6 6 6   G ! !(% ! 8 8 8  ( G  h ' ' ' ' ' ( (rc< |j|dSr)rdeleteritems r_deletezTurtleScreenBase._delete)s#  trc: |jdSr)rr-rs r_updatezTurtleScreenBase._update/s  rc< |j|dSr)rafterrrs r_delayzTurtleScreenBase._delay4s;  ercr |j|}d}n#tj$rd}YnwxYw|S)NTF)r winfo_rgbr-TclError)rr:rgboks r_iscolorstringzTurtleScreenBase._iscolorstring8sS  '##E**CBB{   BBB  s  44c |1|j||dS|jdS)N)rr)rrFrrX)rr:s r_bgcolorzTurtleScreenBase._bgcolorBsH (   GNNN & & & LLNNNNN7<<%% %rc |\}}||jz}||jz}dddd}|j|dz | |||||} |j| \} } } } | | dz fS)Nswrse)rQcenterr`r)textanchorrjfont)rrr create_textrT)rr\txtalignrrXrrrrx0y0x1y1s r_writezTurtleScreenBase._writeKs #1  O  OT;;w""1Q33/7#FFd++BBRTzrrc  j|d|zdSfd}j|d|z||dS)N cj|jjz j|j jz }}||dSrrcanvasxrrcanvasyrrrRrrfunrs reventfunz+TurtleScreenBase._onclick..eventfuneT00<111$+=Aq rr tag_unbindtag_bindrrrnumaddrs` ` r_onclickzTurtleScreenBase._onclick\sz ; G  t]S%8 9 9 9 9 9       G  T=3#6# F F F F Frc  j|d|zdSfd}j|d|z||dS)Nzcj|jjz j|j jz }}||dSrrrs rrz-TurtleScreenBase._onrelease..eventfunwrrrrs` ` r _onreleasezTurtleScreenBase._onreleaseks  ; G  t%?#%E F F F F F       G  T#=#C%s , , , , ,rc  j|d|zdSfd}j|d|z||dS)Nzc j|jjz j|j jz }}||dS#t$rYdSwxYwr)rrrrrrrrrs rrz*TurtleScreenBase._ondrag..eventfuns{ GOOEG44T[@ GOOEG444T[@AC1IIIII DDsAA A.-A.rrs` ` r_ondragzTurtleScreenBase._ondrag~s|  ; G  t%83%> ? ? ? ? ?       G  T#6#.eventfunrrrr_r@)rrrrrs`` r_onscreenclickzTurtleScreenBase._onscreenclicksr  ; GNN=3. / / / / /       GLL,h < < < < cdSrrrRrs rrz0TurtleScreenBase._onkeyrelease..eventfunrrrrrrs ` r _onkeyreleasezTurtleScreenBase._onkeyreleasesl  ; GNN,s2D 9 9 9 9 9      GLL*S0( ; ; ; ; ;rc ?||jdddS|jd|zddSfd}||jd|dS|jd|z|dS)Nz z cdSrrrs rrz.TurtleScreenBase._onkeypress..eventfunrrrrs ` r _onkeypresszTurtleScreenBase._onkeypresss  ;{|T222224d;;;;;     { \844444 _s2H=====rc: |jdSr)rrars r_listenzTurtleScreenBase._listens!  rc |dkr|j|dS|j||dSNr)r after_idlerrrts r_ontimerzTurtleScreenBase._ontimersH 66 G  s # # # # # GMM!S ! ! ! ! !rc> |jdd|S)Nrimage)r create_image)rrs r _createimagezTurtleScreenBase._createimages$ w##Aq#666rc |\}}|j|||jz| |jzf|j||dSNr)rrrr itemconfig)rrr\rrrs r _drawimagezTurtleScreenBase._drawimages] 1 ta$+orDK/?@AAA 4u-----rct |j|||j|dSr)rr tag_lower)rrrs r _setbgpiczTurtleScreenBase._setbgpics@  4u--- $rc8 |j|Sr)rrrs r_typezTurtleScreenBase._types w||D!!!rc |j|fdtdtdD}|S)Nc8g|]}||dz fS)rr).0irs r z/TurtleScreenBase._pointlist..s, > > >Ar!ur!A#wh > > >rrr)rrrangelen)rrplrs @r _pointlistzTurtleScreenBase._pointlistsM W^^D ! ! > > > >q#b''1)=)= > > > rcD|j||||fdS)Nr)rrF)rsrx1sry1srx2sry2s r_setscrollregionz!TurtleScreenBase._setscrollregions' T4t$<=====rcP|j}|D]}t|j|}g}|rI|dd\}}|||z|||z|dd}|I|jj|g|RdS)Nr)rfind_allrrr) r xscalefactor yscalefactorrr coordinates newcoordlistrrs r_rescalezTurtleScreenBase._rescales  "" 0 0Dtw~~d3344KL ."2A21##A $4555##A $4555)!""o  . DGN4 /, / / / / / 0 0rc t|jts|j|jfS||cxur|cxurnn|jj|jjfS|||_|||_|j|||dSr)rrrrrrarJs r_resizezTurtleScreenBase._resizes $'>22 3>4?2 2  0 0 0 0b 0 0 0 0 0 0 0 07$dg&88 8  &DN  !(DO  iR00000rc |j}|dkr |jd}|j}|dkr |jd}||fS)Nrr{r)rrLrM)rr{rs r _window_sizezTurtleScreenBase._window_sizesa ##%% A::GG$E%%'' Q;;WX&Ff}rcD |jjdSr)rtkrrs rrzTurtleScreenBase.mainloops%   rc< tj|||jS)N)parent)r askstringr)rr*prompts rr)zTurtleScreenBase.textinput.s# %eVDGDDDDrcB tj||||||jS)N) initialvalueminvaluemaxvaluer#)raskfloatr)rr*r%defaultminvalmaxvals rrzTurtleScreenBase.numinput=s3 "$UF.4v,0G555 5r)NNNFrrNrb)$rrrrrr/rrrrrrrrrrrrrrrrrrrrrrrrrrrrr)rrrrrrsX<<< ( ( (OOO 3705((((2888 -1-2((((.  &&&&   " G G G G,,,,&MMMM*====$ < < <>>>>$ """777 ...   """   >>> 0 0 0 1 1 1 1       E E E555555rrceZdZ dS)rNrrrrrrrrYs  DrceZdZdS)TurtleGraphicsErrorNr0rrrr2r2bsrr2c eZdZ ddZddZdS)rNc||_|dkr%t|trt|}n|dkrft|trP|dr)t|rt |}n|dkrg}ntd|z||_ dS)Npolygonr.gifcompoundzThere is no shape type %s) rrrrrlowerendswithrr rr2_data)rtype_datas rr/zShape.__init__ns I  $%% #T{{ g  $$$ 5::<<((005VD\\5'..t44D j DD%&AE&IJJ J rc |jdkrtd|jz||}|j|||gdS)Nr7z Cannot add component to %s Shape)rr2r:r)rpolyrjrs r addcomponentzShape.addcomponent~sf  : # #%&HBF*'MNN N ?G 4w/00000rr)rrrr/r?rrrrrgsA  111111rrc8eZdZ d dZd dZdZdZdZdZdS) TbufferrcH||_dgg|z|_d|_d|_dS)NrF)bufsizebufferptrcumulate)rrCs rr/zTbuffer.__init__s+ vh(  rNc|#t|jD] }dg|j|<n||_dgg|z|_d|_dS)Nr)r rCrDrE)rrCr s rraz Tbuffer.resetsX ?4<(( ( ("& A (#DL 6(W,DKrc|jdkrV|js(|jdz|jz|_||j|j<dS|j|j|dSdSr)rCrFrErDrrs rpushz Tbuffer.pushsl ,>??% * "~   {+  <8 # #**,,J OOD,Z E E E OOD,Z E E E E E $ #rc td|_td|_|d|d|_d|_d|_d|_g|_ | dd D]}| d|| d|j ddD].}|d|| d|/dt_dS) Nrrallrrurrr)rr)rr~rrr_bgpic _bgpicname_tracing_updatecounter_turtlesrrSr rrr _pen)rbtnrs rr6zTurtleScreen.clears  ={+ U''++ !   W $ $C LLs # # # # :aaa= ' 'C JJtS ! ! ! OOD# & & & & rNc< ||jS|}|dvrtd|z||_|dvrH||j dz|j dz|jdz|jdzdx|_|_|dS)NrlogoworldzNo turtle-graphics-mode %s)rrrr) r}r8r2rrrrrrarrs rrzTurtleScreen.mode s * <: zz|| 4 4 4%&BT&IJJ J ' ' '  ! !4>/1"4t6F6I'+~q'8$/1:L N N N(+ +DK$+ rc^ |dkr|dt||z }t||z }|\}}||dz |dz |j|j} } |j|z |_|j|z |_||jz} | |jz} |j| z} |j| z}|| | | || |j| z |j| z | dS)Nr) rrrr&rrrrrrr-)rllxllyurxuryxspanyspanwxwy oldxscale oldyscalerrrrs rr(z TurtleScreen.setworldcoordinates-s) * 99;;' ! ! IIg   cCi  cCi  ""$$B 2r"u%%%#{DK9 nu, o- T[ tdk!~$% dD$555 dk)+T[-BCCC rc |Z|dr$td||}n4t dt |t rtd|}||j|<dS)Nr6rz;Bad arguments for register_shape. Use help(register_shape)r5)r8r9rrr2rrr{)rnamerls rr$zTurtleScreen.register_shapeTs , =zz||$$V,, Jgt{{4'8'899)+HJJJ u % % ,)U++E" Trc< t|dkr|d}t|tr<||s|dkr|St dt|z |\}}}n4#t t f$r t dt|zwxYw|jdkrd|||fD\}}}d|cxkrdkr"nnd|cxkrdkrnnd|cxkrdks!nt d t|zd |||fzS) Nrrrzbad color string: %sbad color arguments: %src2g|]}td|zSgo@roundrrs rr z*TurtleScreen._colorstr.."999!uU1W~~999rbad color sequence: %s #%02x%02x%02x)r rrrr2 TypeErrorrr)rr:rgbs r _colorstrzTurtleScreen._colorstrwsa  u::??!HE eS ! ! O""5)) OUb[[ )*@3u::*MNNN NGAq!!:& N N N%&?#e**&LMM M N ?c ! !991ay999GAq!a3Q!]]]]s]]]]]a3%&>U&KLL L!Q**s /A661B'c&dsStdkrfddD}n.s/:::1#d1QqS5k2&&:::r)rrrarfcBg|]}dt|dzS)rWr)rrrs rr z'TurtleScreen._color..s,888!"Sa"%%%888rrzbad colorstring: %sc32K|]}|jzdz VdS)rN)r)rrrs r z&TurtleScreen._color..s/99Q(,999999r)rr r2r)rrrs`` r_colorzTurtleScreen._colorss## K t99>>:::: :::BB YY!^^8888tABBx888BB%&;d&BCC C9999b999999rc ||jS|dkrt||_dS|dkrt||_dSdS)Nrr)rrr)rcmodes rrzTurtleScreen.colormodesQ  =? " C<<#EllDOOO c\\!%jjDOOO\rcx |jD]0}||j|1dSr)r_setmoder}ra)rrs rrazTurtleScreen.resetsG m  F OODJ ' ' ' LLNNNN  rc |jSr)rrs rr,zTurtleScreen.turtless }rc |r||}nd}||}|||}|Sr)rrrrrVr:s rrzTurtleScreen.bgcolorsV   NN4((EEE e$$  KK&&E rc ||jSt||_d|_|t||_|jr|dSdSr)rrrr~r-)rnrs rr+zTurtleScreen.tracersd $ 9= A   "5zzD  =  KKMMMMM  rcB ||jSt||_dSr)r~rrs rrzTurtleScreen.delays+  =# #u::rc tjsdt_t|jdkr'|xjdz c_|xj|jzc_dSdS)NTrr)r _RUNNINGrrrrs r _incrementudczTurtleScreen._incrementudc sc'$ $(L !  =1     1 $     4= 0      rc |j}d|_|D]*}||+||_|dSNT)rr, _update_data _drawturtler)rtracingrs rr-zTurtleScreen.updatesc -   A NN    MMOOOO  rc8 |dSrrrs rr/zTurtleScreen.window_width    ""1%%rc8 |dSNrrrs rr.zTurtleScreen.window_height&rrc |jSr)rrs rrzTurtleScreen.getcanvas/s wrcP t|jSr)sortedr{rrs rrzTurtleScreen.getshapes;s% dl''))***rrc6 ||||dSr)rrrrrs rrSzTurtleScreen.onclickFs'  Cc*****rc |$||jvr|j|n#||jvr|j||||dSr)rremoverrrrrs rrzTurtleScreen.onkeyWsq , ;dj   !!#&&&  " " J  c " " " 3$$$$$rc |$||jvr|j|n%|#||jvr|j||||dSr)rrrrrs rr zTurtleScreen.onkeypressusu 0 ;dj   !!#&&& _DJ!6!6 J  c " " " c"""""rc0 |dSr)r)rxdummyydummys rrzTurtleScreen.listens  rrc4 |||dSr)rrs rr#zTurtleScreen.ontimers# $ c1rc ||jS||jvr|||j|<||j|j|||_dSr)rr|rrr)rpicnames rrzTurtleScreen.bgpicsc ?? " $, & &$(KK$8$8DL ! t{DL$9:::!rc2 ||||Sr)rrJs rr&zTurtleScreen.screensizes ||Iz2666rrNNr.rrb)$rrrrrr/r6rr(r$rrrrar,rr+rrr-r/r.rrrSrr rr#rr&r"r%rrr!rrrr r s H $V  ,DM&F&F&F&FP<    D%%%N!#!#!#!#F+++6 : : :))))*   .8 & & & &111   &&&&&&    + + +++++"%%%<####@    *""""07777&MKKHLLLrr cFeZdZ eddeddedddZdZdZdZefdZdZ d%d Z d Z d&d Z dZ dZdZdZdZdZdZdZdZdZdZd%dZdZdZdZd%dZd%dZdZd Zd'd!Z d(d"Z!d'd#Z"d%d$Z#eZ$eZ%eZ&eZ'eZ(eZ)eZ*eZ+eZ,d S)) TNavigatorr)rrrrrrc|j|_|j|_||_d|_|d|_||t |dSr) DEFAULT_ANGLEOFFSET _angleOffsetDEFAULT_ANGLEORIENT _angleOrientr} undobufferr;rrrars rr/zTNavigator.__init__sf 4 4    drcj tdd|_tj|j|_dS)Nr)r _positionrSTART_ORIENTATIONr}_orientrs rrazTNavigator.resets- sC"4TZ@ rNc ||jS|dvrdS||_|dvrd|_d|_dS|jdz |_d|_dS)Nr)rrrr@r)r}rr _fullcirclers rrzTNavigator._setmodesl <:  4 4 4 F ( ( ( !D  !D    $ 0 3D  "D   rcf ||_d|z |_|jdkr d|_dS|dz |_dS)Nihrrr)r _degreesPerAUr}rr fullcircles r_setDegreesPerAUzTNavigator._setDegreesPerAUsF9% ^ : # # !D    *2 D   rv@c2 ||dSr)rrs rr;zTNavigator.degreess# * j)))))rcF |tjdSr)rrtaurs rr_zTNavigator.radians5s%  dh'''''rcV |j|j|zz}||dSr)rr_goto)rr<endes r_gozTNavigator._goCs07~ x 77 4rcZ ||jz}|j||_dSr)rrrrrs r_rotatezTNavigator._rotateHs-K ##|**511 rc ||_dSrr)rends rrzTNavigator._gotoMs*rc2 ||dSrrrr<s rrDzTNavigator.forwardQs! ( rc4 || dSrrrs rr0zTNavigator.backhs# " (rc4 || dSrrrs rr`zTNavigator.right|s# $ eVrc2 ||dSrr rs rrQzTNavigator.lefts! $ Urc |jSrrrs rr\zTNavigator.poss ~rc |jdSrrrs rr}zTNavigator.xcor ~a  rc |jdSrrrs rr~zTNavigator.ycorrrc ||t|dS|t||dSr)rr)rrrs rrJzTNavigator.gotosJ : 9 JJuay ! ! ! ! ! JJuQ{{ # # # # #rc^ |dd|ddSr)rJrers rrMzTNavigator.homes2  !Q rcd |t||jddSrrrr)rrs rrjzTNavigator.setxs2  5DN1-../////rcd |t|jd|dSrr)rrs rrkzTNavigator.setys2  5*A../////rc |t||}t|tr|}n;t|tr t|}nt|tr|j}t ||jz Sr)rrrrrabs)rrrr\s rr<zTNavigator.distance%s * =1++C a   CC 5 ! ! )CC : & & +C3'(((rc |t||}t|tr|}n;t|tr t|}nt|tr|j}||jz \}}t t jt j||ddz}||j z}|j |j |zz|j zSNrr) rrrrrrrr;atan2rrrr)rrrr\results rrvzTNavigator.towardsEs * =1++C a   CC 5 ! ! )CC : & & +CT^#1t|DJq!$4$455r::UB$$$!D$5f$<<@PPPrc |j\}}ttjtj||ddz}||jz}|j|j|zz|jzSr) rrrr;rrrrr)rrrrs rrKzTNavigator.headinghsi |1t|DJq!$4$455r::UB$$$!D$5f$<<@PPPrc ||z |jz}|j}||dz z|z|dz z }||dS)N@)rKrrr)rto_anglerfulls rrezTNavigator.setheadingws^ ,DLLNN*D,==tBw$tBw. Urc > |jr'|jdgd|j_|}||j}|Mt ||jz }dt tdt |dz zd|zz}d|z|z }d|z}d |ztj tj ||j zz}|d kr | | | }}}| } | } |d kr| d d n|d ||t|D]V} |||||d ||W|| |d kr| | | |||jrd |j_dSdS) NseqTr g@gM@rrrrF)rrIrFrqrrrminrrr_r_tracerrrr r) rradiusextentstepsrqfracrw2ltrdlr s rr5zTNavigator.circles  : ? , O % ) ) )'+DO $  >%F =v;;t//Dc#bVS0$77<===E &L5  1W &L48DL$4$4T5G$GHH H A::rA2s"qA \\^^ [[]] A:: LLA     JJqMMM Ru  A JJu    HHQKKK JJqMMM LLOOOO bS A:: LLR  5 ? -',DO $ $ $ - -rcdSrr)rrs rrqzTNavigator.speed==rcdSrr)rars rr$zTNavigator._tracerr.rcdSrr)rrs rrzTNavigator._delayr.rr)rrr)-rrrrr DEFAULT_MODErrr/rarrr;r_rrrrDr0r`rQr\r}r~rJrMrjrkr<rvrKrer5rqr$rrAr4r1rcrRr]rfrgrdrrrrrsrE#sOOE#sOOE#sOO''L(AAA # # # #...****0 ( ( ( 222 .(**    ! ! ! ! ! !!$!$!$!$F   000$000$))))@!Q!Q!Q!QF Q Q Q8=-=-=-=-B>>>>>>>>>>>> B BH B BH FK DDDrrceZdZ edfdZededfdZddZddZd Zd Z d Z dd Z d Z dZ dZdZdZdZddZddZddZdZdZeZeZeZe Ze ZeZeZdS)TPenrbcV||_d|_t|dSr) _resizemoderr4_reset)rrbs rr/z TPen.__init__s)% DrrXrBcd|_d|_||_||_d|_d|_d|_d|_d|_d|_ d|_ dS)NrTr)rrr)rrrr) _pensize_shown _pencolor _fillcolor_drawing_speed_stretchfactor _shearfactor_tilt _shapetrafo _outlinewidth)rrXrBs rr7z TPen._resetsY  !#  & +rNcz ||jS|}|dvr||dSdS)N)autouserrrb)r6r8rW)rrmodes rrbzTPen.resizemodesR * =# #  0 0 0 HHH & & & & & 1 0rcF ||jS||dS)N)rZ)r9rW)rr{s rrZz TPen.pensizes0 " ==  rcF |jsdS|ddS)NFrYr=rWrs rr[z TPen.penup0s2 }  F rcF |jrdS|ddS)NTrKrLrs rrYz TPen.pendown>s2  =  F rc |jSr)r=rs rrOz TPen.isdownLs }rc dddddd}||jS||vr ||}n/d|cxkrdkr nntt|}nd}|| dS) Nrrrgrr)fastestfastnormalslowslowestrg%@)rq)r>rrrW)rrqspeedss rrqz TPen.speed[s 4b1Q!MM =;  F??5MEE 5    4     e %%EEE urcb |ryt|}|dkr |dx}}n|dkr|\}}n |dkr|x}}||}||}|||dS||j||jfS)Nrrrr)rXrB)r rrWrr;r<)rrVr*pcolorfcolors rr:z TPen.colors >  MD AAvv"&q')a!%a"&&^^F++F^^F++F HHfH 7 7 7 7 7;;t~.. DO0L0LL Lrc |r:||}||jkrdS||dS||jS)N)rX)rr;rWrrs rrXz TPen.pencolorsb 8  /NN4((E&& HHeH $ $ $ $ $;;t~.. .rc |r:||}||jkrdS||dS||jS)N)rB)rr<rWrrs rrBzTPen.fillcolorsb 6  0NN4((E'' HHuH % % % % %;;t// /rc4 |ddS)NTshownrWrs rrpzTPen.showturtles#  trc4 |ddS)NFr\r^rs rrLzTPen.hideturtle s#  urc |jSr)r:rs rrPzTPen.isvisible s {rc  |j|j|j|j|j|j|j|j|j|j |j d }|s|s|St|tr|}ni}| |i}|D] }||||<|jr|jd|fd}d|vr|j|dkrd}d|vrMt|dt r||df|d<|j|dkrd}d|vr|j|dkrd}|r|d|vr |d|_d|vr |d|_d|vr |d|_d|vrGt|dt r||df|d<|d|_d |vr |d |_d |vr |d |_d |vr/|d }t|t&t(fr||f}||_d |vr |d |_d |vr |d |_ d|vr |d|_d|vr |d|_ d |vsd|vsd |vrg|j\} } |j} t+j|j t+j|j } } | | z| | | z| zz| | z| | | | zz zf|_|dS)N) r]rYrXrBrZrqrb stretchfactorrorrtrWFrYTrXrZrBrqrbrbrorr]rt)r:r=r;r<r9r>r6r?r@rCrArdictr-rrIrr_newLinerrrrrrBr)rrWpendict_pdp_p_bufrnewLinesfscxscyshfsacas rrWzTPen.pen! sd- \#'+"&-"&."&/"&-"&+"&"2"&"5"&"3"&"4"&*   w J c4  AAA  # #Cc(F3KK ? 2 O % 1 1 1 >>}) ,, ??!J-// A $* /? @ @* ~:.. >>}) ,,   MMOOO >>iLDM ??z]DN >>iLDM !  !K.%00 C!%;0A!B!B+ nDO a<<G*DK 1   D  a  ?#B"sEl++ "X"$D  A   !- 0D  >>!"9D  a<<G*DK Q;;6DJ a  6Q;;-12D2D*HC#CXdj))48DJ+?+?B!$Rc"frk):!$Rb3r6k): rrrNrrrr4r4s#'|"4 #:.#K0    ''''8    .          $$$$L,M,M,M\#/#/#/J"0"0"0H      {{{{~>>>>>>>>>>>>>> E B B B D B BBBrr4ceZdZ dZdZdS) _TurtleImagecL||_d|_||dSr)rr _setshape)rr shapeIndexs rr/z_TurtleImage.__init__ s(   z"""""rc|j||_|jdcxkrj|jkrnndS|jdcxkrj|jkrnndS|jdvr|jn*|jdkr|jD]}|j|j|_|jdkr|_dS|jdkr,jdj|_dS|jdkr%fdj|jD|_dSdS)Nr5r)rr5r7rc8g|]}Srrrrrs rr z*_TurtleImage._setshape.. s7LLL4&,,..LLLr) rr|rr{r_itemrrr:)rr|rrs @rr{z_TurtleImage._setshape s$ : F F F FfnZ&@&F F F F F F F : D D D DFN:$>$D D D D D D F :- - - NN4: & & & & Z: % %  % %t$$$$^J/5 : " "++--DJJJ Z7 " ",,V^G-D-JKKDJJJ Z: % %LLLL*0.*D*JLLLDJJJ& %rN)rrrr/r{rrrryry s<### LLLLLrryceZdZ gZdedededfdZdZdZdZd Z d Z d Z d Z d;d Z dZdZdZdZddZdZdZd?dZdZdZdZd Zd&GHH HD&++--000 dt$$$%1133"6511  "*.. #( %1133 N+*+ -!.11 rc t|t||||dSr)rrar4r7_clearrrrs rrazRawTurtle.reset s_ $  D   rcR ||dkr d|_dSt||_dSr)rrA)rsizes rrizRawTurtle.setundobuffer s2  <4199"DOOO%dmmDOOOrcH |jdS|jSr)rrNrs rryzRawTurtle.undobufferentries, s*  ? "1**,,,rcx dx|_|_|jD]}|j||j|_g|_|jr|j |j |jg|_| | |j dSr)rrrrrrrrr=rrr8rirrs rrzRawTurtle._clear9 s**..J & &D K   % % % %#{6688 = 4   # #DN 3 3 3*+   4/00000rcX ||dSr)rrrs rr6zRawTurtle.clearG s'   rc|j|jjdkrdSt|jdkr3|j|j|j|j|jdSdSr) rrrr rrrr;r9rs rrzRawTurtle._update_dataV s !!### ; % * * F t  " " K ! !$"68H"&.$- A A A A A # "rc |j}|jdkrdS|jdkrX|||||jdS||jdkrA|D]}||dSdSr) rrrrrrr~rr,)rrrs rrzRawTurtle._update^ s  ?a   F _ ! !             NN    MM&, - - - - -      $))))$$AMMOOOO     *)rc: |j||Sr)rr+)rflagrs rr$zRawTurtle._tracerp s! ${!!$...rc6|j|Sr)rrrUs rrzRawTurtle._color s{!!$'''rc6|j|Sr)rrrUs rrzRawTurtle._colorstr s{$$T***rc t|tr|S |\}}}n4#ttf$r t dt|zwxYw|jjdkrd|||fD\}}}d|cxkrdkr"nnd|cxkrdkrnnd|cxkrdks!nt dt|zd|||fzS)Nrrc2g|]}td|zSrrrs rr z!RawTurtle._cc.. rrrrrr)rrrrr2rr)rrVrrrs r_ccz RawTurtle._cc s dC  K MGAq!!:& M M M%&?#d))&KLL L M ; !S ( (991ay999GAq!a3Q!]]]]s]]]]]a3%&>T&JKK K!Q**s !1Ac |j||j|j}d|_d|_t |}|_||_|_t |jj|_j|j |jjj }|dkr |j_ nn|dkr0 j dj|j_ n8|dkr2fdj |jjjD|j_ |_||S)Nr5rrr7c8g|]}Srrrs rr z#RawTurtle.clone.. s7LLLtf0022LLLr)rrdr=rrryr|rrr{rrrrr:rrr)rrqttypers @rr9zRawTurtle.clone s]  dm$$$  TNN   (>??q!!!t{56< I  #//11AHNN g  #001H1NOOAHNN j LLLL$nT[-CDJLLLAHN"..00 rc | |jjS||jvrt d|z|j||dS)NzThere is no shape named %s)rr|rrr2r{r)rrs rrlzRawTurtle.shape sm & <;) )t{,,....%&BT&IJJ J d### rc ||cxur|cxurnn|j\}}|||jfS|dks|dkrtd| |||f}n||f}n||jd|f}n|j}||j}|d||dS)Nrz(stretch_wid/stretch_len must not be zerorF)rbrbr)r?rCr2rW)r stretch_wid stretch_lenrrbs rrmzRawTurtle.shapesize s ( + 8 8 8 8 8 8 8 8 8 8 8 8'+': $K T-?? ? !  {a//%&PQQ Q  "" +[ 8 +[ 8  $ /2K?MM /M ?(G F,g  ? ? ? ? ?rcH ||jS|d|dS)NrF)rbro)r@rW)rshears rrozRawTurtle.shearfactor s3 $ =$ $ F66666rc` tjddd||dS)Nzturtle.RawTurtle.settiltangle()zn{name!r} is deprecated since Python 3.1 and scheduled for removal in Python {remove}. Use tiltangle() instead.)r )r)warnings _deprecatedrurs rrhzRawTurtle.settiltangle sI ( >X$+ - - - - urc  |4tj|j |jz}||jz |jzS| |jz|jz}tj|tjz}|d|dS)NrF)rbrt) rr;rArrrr_rrW)rrrts rruzRawTurtle.tiltangle7 s < =L,,,t/@@D4--1AA A6D..1BBD<%%0D HHTH 2 2 2 2 2rc\ |||zdSr)rurs rrtzRawTurtle.tilt^ s0 ut~~///00000rc ||cxur |cxur|cxur nn|jS|j\}}}}||}||}||}||}||z||zz dkrtd||||f|_tj| |tjz} tj| tj| } } | |z| |zz | |z| |zz | |z| |zz| |z| |zzf\} } }}| |f|_| |z |_| |_ | ddS)Nrz0Bad shape transform matrix: must not be singularrFrG) rBr2rrrrrr?r@rArW)rt11t12t21t22m11m12m21m22alfarnroa11a12a21a22s rrnzRawTurtle.shapetransformq so & # + + + + + + + + + + + + + + + +# #!-S#s ?#C ?#C ?#C ?#C 9sSy A % %%&XYY Yc3/z3$$$tx/$$B fr#vor#v3 fr#vor#v3@S#s!3hG  F#####rc |j|j\|j\tjzjz }dt |z |z\fd|DS)Nrcpg|]2\}}|z|zzjz z |z|zzjz zf3Sr)rr)rrre0e1p0p1rs rr z(RawTurtle._polytrafo.. sjOOO?E1RT"Q$Y --rB3q5A:v}2L/LMOOOr)rrrrrrr)rr>errrrrs @@@@@r _polytrafozRawTurtle._polytrafo s BB "b6=(6=8 9 9A,!#BOOOOOOOOIMOOO Orc |jj|jj}|jdkr$||j|jdkSdS)Nr5r7)rr{rr|r _getshapepolyr:)rrls rrHzRawTurtle.get_shapepoly sQ  #DK$:; ;) # #%%ek5;*3LMM M $ #rFc |jdks|r |j\n<|jdkr$td|jdz }|dd|f\n |jdkr|St fd|DS)NrFrErg@rrc3JK|]\}}|z|zz|z|zzfVdSrr)rrrrrrrs rrz*RawTurtle._getshapepoly.. sDJJAc!ec!emSUSU]3JJJJJJr)r6rBmaxr9r)rr5r7r*rrrrs @@@@rrzRawTurtle._getshapepoly s   v % % %!%!1 Cc33   ' 'At}S())A!"Aq! Cc33   + +NJJJJJJJ'JJJJJJrc @ |j}|j|jj}|j}|jj}|jr^|jdkrR|jdkrFd|_ |j }|dkr{|j dkrd}n|j dkr|j }n|j }|||}|j|j}}||||||ddS|d kr|||j|dS|d krt+||D]z\} \} }}||| d} || | |||||j dydSdS|j rdS|dkr||d d d nV|d kr-|||j|jd j n#|d kr|D]} || d d d d|_ dS)NrFr5rrrETrjrr{rrr7rqrqrqrr)rr{rr|rrr:rrrr:r6r9rCrrr<r;rrrzipr) rrrlrtitemtshaperfcocrr>s rrzRawTurtle._drawturtle s 8t{56  ! ; ,60A55&/A:M:M',D $[F !!#z11q11%//T]+a(:(:6(B(BCC$.B  B<=4!IIIII'!!!!%@@@@@*$$,/v,>,>__(D.4R??4+=+=dD+I+IJJD$$T4dhhrll-1XXb\\ASY]%____%$__ '  !!  (@"bIIII'!!!!%*0.*A*GIIII*$$!MMD$$T+CRLLLL'+D $ $ $rc  |j}|j|jj}|j}|j}|dkr|}|jdkrd}n|jdkr|j}n|j }| | |}|j |j }}||||||dn|dkr2|d}|||j|n|d krg}|D]+} |} || ,t'|}t)||D]x\} \} }}| | | d} || | |||||j dy|j||jd |f|S) Nr5rrrETrrrr7rs)rr{rr|rr:rr6r9rCrrr<r;rrrrrrrrrrrI) rrrlrrstitemrrrelementrr>s rrszRawTurtle.stamp s/ t{56  I  ''))F:--1qq!V++QQ'!OOD$6$6v$>$>??E_dnB   VUR89t  E E E E g  ((,,F   fdnf = = = = j F! $ $))++ d####6]]F(+FF(;(; [ [$ntRt'9'9$'E'EFF  t$((2,,)-"T=OUY![[[[ v&&& gv./// rc ||jvrit|tr |D]}|j|n|j||j|d|f}|j}||jvrdS|j|}|j|||j kr|j dz |j z|_ |j |j dz|j zdgdS)Nrsr) rrrrrrrrDindexrErCinsert)rstampidsubitemrbufrs r _clearstampzRawTurtle._clearstamp s do % %'5)) -&11GK''00001 ##G,,, O " "7 + + +!o sz ! ! F   && $ CG  w{ck1CG 3719ck1D6:::::rcZ |||dSr)rr)rrs rr7zRawTurtle.clearstamp. s.  !!! rc ||jdd}n%|dkr|jd|}n|j|d}|D]}|||dSr)rrr)rrtoDeleters rr8zRawTurtle.clearstamps= s " 9qqq)HH !VVrr*HHqrr*H # #D   T " " " " rc  |j|j|jt|jt f}|j}d|j|||j|j dd| |j|j ddff}|j r|j ||j}|jr |jdkr||z }|d|jzdz|d|jzdzz}dt%|dzdd|jzz|jzz z}|d|z z} t'd|D]d} | dkrd } nd } || | zz|_|jr/||j||jf|j|j| |e|jr#||jd d |j |jr|j |t|jt r|j|||_|jr|j|t5|j dkr||dS)Ngorrrrr皙?rTFrqrqrrjr{*)r=r;r9rrrrrrrrrrrIr>rrrrr rrrrrrr rd) rrgo_modesr undo_entrystartdiffdiffsqnhopsdeltarrs rrzRawTurtle._gotoY s ]^]557DNC+&qqq)''(<==jm% ? - O  , , , ; M6?a//ID1gfm+a/476=3H12LLFc63;C,<)=dk)IJKKKECI&E1e__  66CCC!&!2=I$$T%9&+T^%<%)^T]CIII } M  !57G46dm!MMM = )   # #C ( ( ( dnd + + ' N ! !# & & &   # J  c " " " t 2 % % MMOOO rc |\}}}}|\}}}} |\} } } |jt|j|z dkrtd| |_| |_| ddgkrd} n|} | | | |fd|jD}|D]1}||j |2|}|j rj dkr||z }|dj zd z|dj zd zz}dt|dzd d |j zz|j zz z}|d |z z}td|D]U}|dkrd }nd}|||zz|_|r%|j||jf||||V|r|jdd|||_|jrJt'|jdkr|j|jgkrd|_d|_| rB|jgkrd|_tdn |j|j|dS)Nrz$undogoto: HALLO-DA-STIMMT-WAS-NICHT!rqrrcNg|]!}|vr|dk|"S)r)r)rr rrs rr z'RawTurtle._undogoto.. sBDDD!aunn(. Q6(A(A(A(A(ArrrrrrrTFrzUnwahrscheinlich in _undogoto!)rrrrrrrrrrr>rrrrr rrrr rrKr)rentryoldnewrcoodatadrawingpcpsrCcLIcLr usepctodeleter rrrrrrrrrs @@r _undogotozRawTurtle._undogoto s &+#S(G#+ R$RU t~# $ $s * * 9 : : :" &&! ! !EEEbuB777DDDDDtzDDD ! !A NN1    J  a  ; B6?a//9D1gfm+a/476=3H12LLFc63;C,<)=dk)IJKKKECI&E1e__  66CCC!$uqy2$$T%9&+T^%<%'S222  B  !57G46b!BBB   "4:""    zR%*"!  %~##!%67777+""$$$ rc |jr"|jd||jf||jz}|j|}|jj}|dkr|jdkryd|jz}dtt||z z}d|z|z }t|D]5}|j||_| 6||_| dS)Nrotrrg@r) rrIrrrrrr>rrr r)rr neworientranglevelr'rrs rrzRawTurtle._rotate s ? E O %0B!C D D D ##L''.. +& a< ? ? ? rcP |rt|jdkrT|j|j|j|j|jr!|jd|jfdx|_|_| dSdS)Nrrdofill) rCr rrrrr<rrIrrs rr?zRawTurtle.end_fill s  <<>> 4>""Q&& %%dndn+/?&<<<?EO(((DN)CDDD.2 2DNT^ LLNNNNN  rc\ |svt|ttfr3||}|jt |jdz}n[|j}|s|jt |jdz}n4||jt |jdz}||}t|jdrb|j |j ||}|j ||j r|j d|fdSdS|}|j r'|j dgd|j _ |dkr|||||||d||n#||wxYw|j rd|j _dSdS) Nrf_dotr=r!TrErF)rrrrr9rr;hasattrrrrrrrrIrWrFrbrNrYrZrXrD)rrr:rrWs rr=z RawTurtle.dot( s  *$e -- At,,}s4=!'<'<<A=3t}a+@+@@D|}s4=!'<'<<NN5))E 4; ' ' 1;##DND%@@D J  d # # # 4$$eT]33333 4 4((**C 0$$eW---+/( ??$$..GGIII  T""" e$$$ Q   1+0((( 1 1s (A?G==Hc |j|j||||j\}}||j||jr|jd|f|S)Nwri) rrrr;rrrrrI)rrrrrrs rrzRawTurtle._writeX s K&&t~sE4:>.JJ c  $ ? 0 O % / / / rrQArialr_rRcX |jr'|jdgd|j_|t |||}|r-|\}}||||jrd|j_dSdS)Nr!TF)rrIrFrrr8r\rf)rargmoverrrrrs rr|zRawTurtle.writec s $ ? , O % ) ) )'+DO $kk#c((EKKMM488  88::DAq KKQ    ? -',DO $ $ $ - -rc0 |jg|_d|_dSr)rrrrs rr3zRawTurtle.begin_poly s# n% !rc d|_dSNF)rrs rr@zRawTurtle.end_poly s #rc> |jt|jSdSr)rrrs rrEzRawTurtle.get_poly s)  : !$$ $ " !rc |jSr)rrs rrGzRawTurtle.getscreen s {rc |Srrrs rrIzRawTurtle.getturtle s  rc8 |j|Sr)rrrs rrzRawTurtle._delay s {  '''rrc~ |j|jj||||dSr)rrrrrrs rrSzRawTurtle.onclick s; " T[.S#>>> rc~ |j|jj||||dSr)rrrrrrs rrUzRawTurtle.onrelease s; * t{0#sC@@@ rcV |j|jj|||dSr)rrrrrs rrTzRawTurtle.ondrags0 " DK-sC=====rcJ |jdS|dkrA|\}}|| |z|jz |j}dS|dkr|d}||dS|dkr||dS|dvr>|d}|j||j |dS|dkr(|d}|j |ddd dS|d krW|d}dx|_ |_ ||jvr6|j||j |dSdS|d kr')2 " 7 7 7 7 7 { " "7D.2 2DNT^tz!! ##D))) !!$'''''"!u__ HHT47 # # # O   ! ! ! ! !_rc( |jdS|j}|d}|dd}|dkr@|r<|}||d|dd|:dSdS|||dS)Nrrr!)rrKr)rrrr<s rrxzRawTurtle.undo8s ? " F""$$aABBx U?? .xxzz 47DH--- . . . . . JJvt $ $ $ $ $rrrrb)NNNN)Frw)FrQr r.)8rrrrrr/rariryrr6rrr$rrrr9rlrmrorhrurtrnrrHrrrsrr7r8rrrrdrCr2r?r=rr|r3r@rErGrIrFrrSrUrTrrxrwrrrr r sG"G} $%5 6i&&&&P2,,,& - - - 1 1 1   AAA!!!$////*(((+++ + + +&&&P6&?&?&?&?P7777.6%3%3%3%3N111&%$%$%$%$P O O ONNN" K K K K$,$,$,P+++Z;;;,   8333j???B$0000 0 0 0*(.1.1.1.1`   ----: " " " # # # % % % "F(((( *2>>>>*"""@%%%:JJJrr cd tjtt_tjSr)r _screenrrrrr r [s$%~  >rceZdZdZdZedZdZededededfdZd Z d Z d Z d Z dS) rNr*ctjbtxt_|_|jtj|j|jtjtd}td}td}td}td}td}|j |||||j t_t |tj| ||||dSdS)Nr{rrrrr)r_rootrdr*_titlerx_destroyr4rrlrnr r/r')rr{rrrrrs rr/z_Screen.__init__is = ). 0GMDJ J  W^ , , , J  / / / ? "ME(^F[)Il+J[)I[)I J " "5&)Z H H H"j3355GO  ! !$ 8 8 8 JJufi ; ; ; ; ; # "rr{rrrc t|jdsdS|j}|j}t |t rd|cxkrdkrnn||z}|||z dz }t |t rd|cxkrdkrnn||z}|||z dz }|j|||||dS)Nrsrrr)rr$r{r~rrrsr-)rr{rrqrrrshs rr'z _Screen.setups  .tz>22  F Z ! ! # # Z " " $ $ eU # # UauHE >5jA%F fe $ $ f)9)9)9)9)9)9)9)9)9YF >6kQ&F vvv>>> rcv tjtj||t_dSr)rr$r*r%)r titlestrings rr*z _Screen.titles2  = $ M   , , ,$rc|j}|tjur0dt_dt_dt_dt_dt _|dSr) r$rr rr!r4r rrw)rroots rr&z_Screen._destroysKz 7= FK!FN GM"GO %  rc0 |dSr)r&rs rrz _Screen.byes rc fd}|tdrdS tdS#t$rt dYdSwxYw)Nc2 dSr)r)rrrs rexitGracefullyz+_Screen.exitonclick..exitGracefullys 8 HHJJJJJrrr)rSrrAttributeErrorexit)rr0s` rrz_Screen.exitonclicks $      ^$$$    F  JJJJJ    GGGGGG s=AA) rrrr$r4rr%r/r'r*r&rrrrrrrcs EG ']F<<<,w-X+&tK/@&&&&P%%%"rrcJeZdZ dZdZedededfdZdS)r Nrlrrctjtt_t|tj|||dS)N)rlrr)r r!r r r/)rrlrrs rr/zTurtle.__init__sM > !#XXFN4!&*8#*  , , , , ,r)rrrrr!rr/rrrr r sR DGG} $%5 6i , , , , , ,rr turtle_docstringdictc i}tD]}d|z}t|j||<tD]}d|z}t|j||<t d|zd5}t d|D}|d|ddD]E}|dt|z|d ||zF|d}|dt|z|d ||z|d |ddddS#1swxYwYdS) Nz_Screen.zTurtle.z%s.pyrc3^K|](}|ddtv$|V)dS)rrN)r _alias_listrs rrz&write_docstringdict..sF==Aa ;;;;;;==rzdocsdict = { rz%s : z """%s """, z """%s """ z} ) _tg_screen_functionsr__doc___tg_turtle_functionsrrr|reprclose)rdocsdict methodnamerrrs rrrs H*** #S ) ***  "S ) g  % % ======= "###9 ? ?C GGHtCyy( ) ) ) GG- = > > > >2h 499$%%% (8C=8999                     s#C3E##E'*E'c dd|iz}t|}|j}|D]?} ||t|_#t $rt d|zYrr:rr)langmodnamemoduler>rs rread_docstringsrE s 2Z 4MMG  FH33 3 ( DII   3 3 3 +c1 2 2 2 2 2 3 33sAA0/A0zCannot find docsdict forz;Unknown Error when trying to import %s-docstring-dictionarycP dx}}tj|j\}}}|dd}|dd}|jpg}d|D}dgt |t |z z|z}dt ||D} |0| d|z|d|z|0| d|z|d|zd| }d|z}d|}d|z}||fS) Nrrcg|]}d|S)rr)rrs rr z"getmethparlist..Ms777UU 777rcg|] \}}||z Srr)rrdflts rr z"getmethparlist..Os B B BYS$cDj B B Br*z**z, z(%s))inspectgetargs__code__ __defaults__r rrr) obdefTextcallTextrVvarargsvarkwitems2realArgsdefaultsitems1s rgetmethparlistrX=sJGh#?2;77D'5 !""XFABBxH$"H77h777Hts8}}S]]23h>H B B#h*A*A B B BF cGm$$$ cGm$$$  dUl### dUl###iiGwGyy  H H H rc ddl}|dStd}|d|zd}|d|z}|d|}|S)Nrr%s.r \(.+ %s\)::rerreplacecompilesub)docstrr^ turtlename newdocstrparexps r_turtle_docreviserf\k III ~to&Juz1"55I ZZ3 4 4F 3 **I rc ddl}|dStd}|d|zd}|d|z}|d|}|S)NrrrZrr[r\r])rbr^ screennamerdres r_screen_docreviserjhrgrardef {name}{paramslist}: if {obj} is None: if not TurtleScreen._RUNNING: TurtleScreen._RUNNING = True raise Terminator {obj} = {init} try: return {obj}.{name}{argslist} except TK.TclError: if not TurtleScreen._RUNNING: TurtleScreen._RUNNING = True raise Terminator raise cH|D]}t||}t|\}}|dkrtd||>>>>>)objinitr paramslistargslist)getattrrXr __func_bodyformatrglobalsr:) functionsrrlrm docreviser?rpl1pl2defstrs r_make_global_funcsrys B B j))!&))S "99 (C % % % ##$Z/2S$BB VWYY(1 &.(A(A *%% B BrzTurtle._screenzScreen()z Turtle._penzTurtle()__main__c^trtdStdSr)rOr^rVrrr switchpenr|s( 88  DDDDD DDDDDrc ttdttdt t dt dD]}|dkrtt dD] }tdtd!|dkrtdtttd t t d td td ttdtdtdtdtd t tdd tdd tdt dD]>}tdtdtdtd?tdtt dD]>}tdtdtdtd?tdS)NTdrrrfrZmaroonrErrF startstartrredra)rar+rzr1r>r{r r2rDrQr:r?r`r|)r rs rdemo1rs , t     aq  AAvv 1XX   RAvvh DDD BKKK FFFF a gu   b   b   c   lA gq e q  A BKKK HHH BKKK "IIIIt  q  A BKKK HHH BKKK "IIII rc< tdttdtt ddt dddz }t dtdD] }tt|d!tdtrttttdtd d}t!d tdtd td d D]}|dkr(t#t%d d|zz dd|ztdD] }t'|td!t)|dz }tdttdzdztdt+t'dt dt-t/ddtdt#tdD]?}tddt dt'dt d@t)tdt+t'dt-t1dt3}|dt7}|d|d| |d|d||dd|d||d|dd|d|dtt |d}||dkr|d|d ||||d|d!zdkr6| | t|dz }||dk| d"d#d$%|d&|dd'}tCj"dtr6| | t6|d| d(d)*|#|ddS)+Nrrrrrrzwait a moment...rgreenrrXrWx FrEryellowrf2rrEi(rgblueorangerg @g333333?rzCAUGHT! )r rWboldr`)rrrc>ttdSr)rr)rrs rbabazdemo2..baba.s MMM EEEEErz Click me!)Courierrr)r)$rqrrrZrervr<rcr r|r5r|ryrxrarRrrXr2rBrAr?r^rVr:rlrIrbr rQrzrJr>rstimesleeprS)r%rlaenger trirrMrs rdemo2rs(( a  71a==!!!!Q# 2r  A KKK 62      !!!!!  FFF !!   2#  3r2 " "A1uu #bd(Ar!t,,,1XX  6 3 JJJ bLF rFFF 57719b. ! ! ! ! 3  2 2  eH a q  A 2rNNN rFFF rFFF rFFFF  2  2  hkk v&!!! X  B Q  C "   Q VH%%%q ! 76??###ll6""Q&& IIcNNN IIcNNN NN3;;v.. / / / FF1IIIrzQ   QJEll6""Q&& *#8 HHH W U    1 !!  HHJJJ KKMMM !!  r  -(? AAA D!r)r)r5)F_vertkinterr-rrrrKrros.pathrrrcopyrr _tg_classesr9r; _tg_utilities__all__r8rrrrrrrrrrrr.rr2rfrdobjectrrr2rrAr rr4ryr r r rr rrrE _LANGUAGE ImportErrorrXrfrjrqryrrrr|rrrrrrrsr2L\7  '''''''''' III ))) ! ! !'/ - -0D D  (> *,,,  # 4 c  c  T  T     S    $    W  g  z  D  I ! "")'   ,:<1Jt111 E /000001*$*$*$*$*$E*$*$*$j1 ....*a#a#a#a#a#RXa#a#a#FI666)))))BE)))0 E5E5E5E5E5vE5E5E5Z      )   ) ,1,1,1,1,1F,1,1,1^"6"6"6"6"6f"6"6"6Liiiii#iiiV||||||||~IIIII6IIIXLLLLL6LLL>DDDDDjDDDL$ CCCCClCCCJ,,,,,Y,,,(     D333"   MI """111 E $i00000MMM E HBK LMMMMMM >        B B B'#Z1BDDD' *.?AAA z 222jaaaF EGGG EGGGKMMMMMCs* B''B:9B:G((H;HH