Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
natron / opt / Natron2 / lib / python2.7 / lib-tk / turtle.pyo
Size: Mime:
ó
ÂgWcO@sdZdZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZddlm
Z
ddlTddd	d
ddd
ddg	Zddddddddddddddddd d!d"d#d$d%d&d'd(d)gZd*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmd%dndodpdqdrd(d)dsdtdugOZdvdwdxgZdydzd{d|d}d~dd€dd‚dƒd„d…d†d‡dˆd‰dŠd‹dŒddŽddd‘gZeeeed’geZdd+d.d;dGdKdOdUdWd\d]d_d`didndqdrgZid“dr6d”d•6d–d—6d˜d™6edš6ed›6dœd6dd6džd6dŸd 6d¡de6d¢dQ6d¢d=6d£d[6ed¤6d¥d¦6d§d¨6d©dª6d«d$6ed¬6Zd­„Zd®„ZyeeƒWnd¯GHnXdefd°„ƒYZd±„Zd²„Zd³d´Zfdµ„Z dej!fd¶„ƒYZ"e e"ej#d·ƒd¸ej$fd¹„ƒYZ%ej#Z#dºe&fd»„ƒYZ'd’e(fd¼„ƒYZ)d½e(fd¾„ƒYZ*de&fd¿„ƒYZ+dÀe&fdÁ„ƒYZ,de'fd„ƒYZ-dÃe&fdĄƒYZ.dÅe&fdƄƒYZ/dÇe&fdȄƒYZ0d
e/e.fdɄƒYZ1e1Z2dʄZ3dËe-fd̄ƒYZ4de1fd̈́ƒYZ5e5Z6dÎdτZ7dЄZ8ed¦Z9ye9d¥krDe8e9ƒnWn)e:k
radÑGe9GHndÒe9GHnXdӄZ;dԄZ<dՄZ=dÖZ>dׄZ?e?ee4dØdÙe=ƒe?ee5dÚdÛe<ƒej@ZAZ@eBdÜkrd݄ZCdބZDd߄ZEeDƒeEƒeFƒndS(às

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: http://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, gif-images 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.

s5turtle 1.0b1 - for Python 2.6   -  30. 5. 2008, 18:08iÿÿÿÿN(tisfiletsplittjoin(tdeepcopy(t*tScrolledCanvastTurtleScreentScreent	RawTurtletTurtletRawPentPentShapetVec2Dtaddshapetbgcolortbgpictbyetclearscreent	colormodetdelaytexitonclickt	getcanvast	getshapestlistentmodetonkeyt
onscreenclicktontimertregister_shapetresetscreent
screensizetsetuptsetworldcoordinatesttitlettracertturtlestupdatet
window_heighttwindow_widthtbacktbackwardt
begin_fillt
begin_polytbktcircletcleart
clearstamptclearstampstclonetcolortdegreestdistancetdottdowntend_filltend_polytfdtfillt	fillcolortforwardtget_polytgetpent	getscreent	getturtletgototheadingt
hideturtlethomethttisdownt	isvisibletlefttlttonclicktondragt	onreleasetpdtpentpencolortpendowntpensizetpenuptpostpositiontputradianstrighttresett
resizemodetrttsetht
setheadingtsetpostsetpositiontsettiltanglet
setundobuffertsetxtsetytshapet	shapesizet
showturtletspeedtsttstampttiltt	tiltanglettowardst
turtlesizetundotundobufferentriestuptwidthtwritetxcortycortwrite_docstringdicttdonetmainlooptacostasintatantatan2tceiltcostcoshtetexptfabstfloortfmodtfrexpthypottldexptlogtlog10tmodftpitpowtsintsinhtsqrtttanttanht
Terminatorgà?gè?theightit	canvwidthi,t
canvheightt	leftrightt	topbottomtstandardgð?i
iètundobuffersizetclassictblacktnoresizetvisibletenglishtlanguagetturtlet
exampleturtletscreent
examplescreensPython Turtle Graphicst
using_IDLEcCst|dƒ}|jƒ}|jƒi}xÝ|D]Õ}|jƒ}|s2|jdƒr`q2ny|jdƒ\}}Wnd||fGHq2nX|jƒ}|jƒ}|dkrÈt|ƒ}n5y+d
|kræt|ƒ}nt|ƒ}WnnX|||<q2W|S(s/Convert content of config-file into dictionary.trt#t=sBad line in config-file %s:
%stTruetFalsetNones''s""t.(sTruesFalsesNones''s""(	topent	readlinestclosetstript
startswithRtevaltfloattint(tfilenametftcfglinestcfgdicttlinetkeytvalue((s./lib-tk/turtle.pytconfig_dict·s2

cCs¸d}i}i}t|ƒr-t|ƒ}nd|krJd|d}ny%ttƒ\}}t||ƒ}Wn
d}nXt|ƒršt|ƒ}ntj|ƒtj|ƒdS(s@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.
    s
turtle.cfgtimportconfigs
turtle_%s.cfgtN(RR¹Rt__file__Rt_CFGR%(Rµtdefault_cfgtcfgdict1tcfgdict2theadttailt	cfg_file2((s./lib-tk/turtle.pyt
readconfigÕs 


s"No configfile read, reason unknowncBsheZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„ZRS(s¯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
    cCstj|||fƒS(N(ttuplet__new__(tclstxty((s./lib-tk/turtle.pyRÆscCs%t|d|d|d|dƒS(Nii(R
(tselftother((s./lib-tk/turtle.pyt__add__scCsLt|tƒr/|d|d|d|dSt|d||d|ƒS(Nii(t
isinstanceR
(RÊRË((s./lib-tk/turtle.pyt__mul__s cCs?t|tƒst|tƒr;t|d||d|ƒSdS(Nii(RÍR±R°R
(RÊRË((s./lib-tk/turtle.pyt__rmul__scCs%t|d|d|d|dƒS(Nii(R
(RÊRË((s./lib-tk/turtle.pyt__sub__scCst|d|dƒS(Nii(R
(RÊ((s./lib-tk/turtle.pyt__neg__scCs|dd|dddS(Niiigà?((RÊ((s./lib-tk/turtle.pyt__abs__scCs}t|d|dƒ}|tjd}tj|ƒtj|ƒ}}t|d||d||d||d|ƒS(s.rotate self counterclockwise by angle
        iig€f@(R
tmathR‰R|R‹(RÊtangletperptcts((s./lib-tk/turtle.pytrotatescCs|d|dfS(Nii((RÊ((s./lib-tk/turtle.pyt__getnewargs__&scCsd|S(Ns(%.2f,%.2f)((RÊ((s./lib-tk/turtle.pyt__repr__(s(
t__name__t
__module__t__doc__RÆRÌRÎRÏRÐRÑRÒRØRÙRÚ(((s./lib-tk/turtle.pyR
s
									cCs}t|jƒ}|jƒx|D]}t||ƒq Wx?|jjƒD].\}}t|ƒtjkrG|||<qGqGWdS(s#helper function for Scrolled CanvasN(	tlistt	__bases__treverset__methodDictt__dict__titemsttypettypestFunctionType(RÇt_dicttbaseListt_superR·R¸((s./lib-tk/turtle.pyRá4s

cCsi}t||ƒ|jƒS(s#helper function for Scrolled Canvas(Rátkeys(RÇRç((s./lib-tk/turtle.pyt	__methods>s
s*def %(method)s(self, *args, **kw): return s*self.%(attribute)s.%(method)s(*args, **kw)c
Bs&i}e||ƒx>|jƒD]0}|d dksF|ddkr ||=q q Wx$|D]}||kr[||=q[q[Wx*e|ƒD]}||krˆ||=qˆqˆWxw|jƒD]i\}}i|d6|d6}e|ƒejkrei|d6|d6}	n|	|U|||j|<qµWdS(snHelper functions for Scrolled Canvas, used to forward
    ScrolledCanvas-methods to Tkinter.Canvas class.
    it_iÿÿÿÿtmethodtfunct	attributeN(	RáRêRëRãRäRåt
StringTypet__stringBodyRâ(
t	fromClassttoClassttoParttexcludeRçtexRíRîtdt
execString((s./lib-tk/turtle.pyt__forwardmethodsHs"
 
cBs}eZdZddddd„Zdddd„Zd„Zd„Zd„Zd	„Z	d
„Z
d„Zd„Zd
„Z
RS(sÄModeled after the scrolled canvas class from Grayons's Tkinter book.

    Used as the default canvas, which pops up automatically when
    using turtle graphics functions or the Turtle class.
    iôi^iXcCs
tjj||d|d|ƒ|jƒ|_|||_|_|||_|_d|_	tj
|d|d|d|j	dtjddƒ|_tj
|d|jjd	tjƒ|_tj
|d|jjƒ|_|jjd
|jjd|jjƒ|jdd
dddƒ|jdd
dddƒ|jjddd|ddddddddddddƒ|jjddd|ddddddddddddƒ|jjddd|ddddddddddddƒ|jƒ|jjd|jƒdS(NRpR‘twhitetbgtrelieftborderwidthitcommandtorienttxscrollcommandtyscrollcommanditweightitminsizetpadxtin_tpadytrowtcolumntrowspant
columnspantstickytnewss<Configure>(tTKtFramet__init__twinfo_toplevelt_rootwindowRpR‘R’R“RûtCanvastSUNKENt_canvast	Scrollbartxviewt
HORIZONTALthscrolltyviewtvscrollt	configuretsettrowconfiguretcolumnconfiguretgridRXtbindtonResize(RÊtmasterRpR‘R’R“((s./lib-tk/turtle.pyRgs,	
$$$
c	CsÙ|r||_n|r$||_n|r6||_n|jjd|d|jd|jd|jd|jdfƒ|jjd|j|jd|jƒ|jjd|j|jd|jƒ|j	ƒdS(s<Adjust canvas and scrollbars according to given canvas size.Rûtscrollregionigà?iN(
R’R“RûRtconfigtxview_movetoRptyview_movetoR‘t
adjustScrolls(RÊR’R“Rû((s./lib-tk/turtle.pyRX€scCs|jjƒ}|jjƒ}|jjd|j||jƒ|jjd|j||jƒ||jks€||jkrý|jjddd|ddddddd	dd
dddƒ|j	jddd|ddddddd	dd
dddƒn|jj
ƒ|j	j
ƒd
S(sA Adjust scrollbars according to window- and canvas-size.
        gà?RiRRRRiR	R
RRN(Rtwinfo_widthtwinfo_heightR%R’R&R“RRRtgrid_forget(RÊtcwidthtcheight((s./lib-tk/turtle.pyR'’s""$$
cCs|jƒdS(sself-explanatoryN(R'(RÊtevent((s./lib-tk/turtle.pyR!¢scGs|jj|ŒS(s@ 'forward' method, which canvas itself has inherited...
        (Rtbbox(RÊtargs((s./lib-tk/turtle.pyR.¦scOs|jj||ŽS(s@ 'forward' method, which canvas itself has inherited...
        (Rtcget(RÊR/tkwargs((s./lib-tk/turtle.pyR0«scOs|jj||ŽdS(s@ 'forward' method, which canvas itself has inherited...
        N(RR$(RÊR/R1((s./lib-tk/turtle.pyR$°scOs|jj||ŽdS(s@ 'forward' method, which canvas itself has inherited...
        N(RR (RÊR/R1((s./lib-tk/turtle.pyR µscOs|jj||ŽdS(s@ 'forward' method, which canvas itself has inherited...
        N(Rtunbind(RÊR/R1((s./lib-tk/turtle.pyR2ºscCs|jjƒdS(s@ 'forward' method, which canvas itself has inherited...
        N(Rtfocus_force(RÊ((s./lib-tk/turtle.pyR3¿sN(RÛRÜRÝRR¨RXR'R!R.R0R$R R2R3(((s./lib-tk/turtle.pyRas							Rt_RootcBsMeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	RS(s'Root class for Screen based on Tkinter.cCstjj|ƒdS(N(R
tTkR(RÊ((s./lib-tk/turtle.pyRÉscCs8t|||||ƒ|_|jjddddƒdS(NtexpandiR:tboth(RRtpack(RÊRpR‘R+R,((s./lib-tk/turtle.pytsetupcanvasÌscCs|jS(N(R(RÊ((s./lib-tk/turtle.pyt
_getcanvasÐscCs!|jd||||fƒdS(Ns%dx%d%+d%+d(tgeometry(RÊRpR‘tstartxtstarty((s./lib-tk/turtle.pytset_geometryÓscCs|jd|ƒdS(NtWM_DELETE_WINDOW(twm_protocol(RÊtdestroy((s./lib-tk/turtle.pyt	ondestroyÖscCs
|jƒS(N(twinfo_screenwidth(RÊ((s./lib-tk/turtle.pyt	win_widthÙscCs
|jƒS(N(twinfo_screenheight(RÊ((s./lib-tk/turtle.pyt
win_heightÜs(
RÛRÜRÝRR9R:R>RBRDRF(((s./lib-tk/turtle.pyR4Çs						tTurtleScreenBasecBs[eZdZed„ƒZed„ƒZd„Zd„Zddde	d„Z
d„Zddde	d„Zd„Z
d	„Zd
„Zd„Zdd„Zd
„Zddd„Zddd„Zddd„Zddd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z dddd„Z!d„Z"RS( sàProvide the basic graphics functionality.
       Interface between Tkinter and turtle.py.

       To port turtle.py to some different graphics toolkit
       a corresponding TurtleScreenBase class has to be implemented.
    cCs&tjddddƒ}|jƒ|S(s$return a blank image object
        RpiR‘(R
t
PhotoImagetblank(timg((s./lib-tk/turtle.pyt_blankimageês
cCstjd|ƒS(s`return an image object containing the
        imagedata from a gif-file named filename.
        tfile(R
RH(R²((s./lib-tk/turtle.pyt_imageòscCsº||_t|tƒr3|jj}|jj}nat|jjdƒƒ}t|jjdƒƒ}|jjd|d|d|d|dfƒ||_||_d|_|_	dS(NRpR‘R#igð?(
tcvRÍRR’R“R±R0R$txscaletyscale(RÊRNtwth((s./lib-tk/turtle.pyRùs	1		cCs|jjdddddƒS(s<Create an invisible polygon item on canvas self.cv)
        iR:R»toutline(iiiiii(RNtcreate_polygon(RÊ((s./lib-tk/turtle.pyt_createpolysc
Csåg}x=|D]5\}}	|j||jƒ|j|	|jƒq
W|jj||Œ|dk	r~|jj|d|ƒn|dk	r£|jj|d|ƒn|dk	rÈ|jj|d|ƒn|rá|jj|ƒndS(s`Configure polygonitem polyitem according to provided
        arguments:
        coordlist is sequence of coordinates
        fill is filling color
        outline is outline color
        top is a boolean value, which specifies if polyitem
        will be put on top of the canvas' displaylist so it
        will not be covered by other items.
        R:RSRpN(tappendRORPRNtcoordsR¨t
itemconfiguret	tag_raise(
RÊtpolyitemt	coordlistR:RSRpttoptclRÈRÉ((s./lib-tk/turtle.pyt	_drawpolyscCs.|jjdddddddddtjƒS(s9Create an invisible line item on canvas self.cv)
        iR:R»Rpitcapstyle(RNtcreate_lineR
tROUND(RÊ((s./lib-tk/turtle.pyt_createline$s$c	CsÏ|dk	rhg}x=|D]5\}}|j||jƒ|j||jƒqW|jj||Œn|dk	r|jj|d|ƒn|dk	r²|jj|d|ƒn|rË|jj|ƒndS(sQConfigure lineitem according to provided arguments:
        coordlist is sequence of coordinates
        fill is drawing color
        width is width of drawn line.
        top is a boolean value, which specifies if polyitem
        will be put on top of the canvas' displaylist so it
        will not be covered by other items.
        R:RpN(R¨RVRORPRNRWRXRY(	RÊtlineitemR[R:RpR\R]RÈRÉ((s./lib-tk/turtle.pyt	_drawline*s
cCs|jj|ƒdS(s]Delete graphics item from canvas.
        If item is"all" delete all graphics items.
        N(RNtdelete(RÊtitem((s./lib-tk/turtle.pyt_deleteAscCs|jjƒdS(s(Redraw graphics items on canvas
        N(RNR%(RÊ((s./lib-tk/turtle.pyt_updateGscCs|jj|ƒdS(s-Delay subsequent canvas actions for delay ms.N(RNtafter(RÊR((s./lib-tk/turtle.pyt_delayLscCs=y|jj|ƒ}t}Wntjk
r8t}nX|S(sCCheck if the string color is a legal Tkinter color string.
        (RNt	winfo_rgbR¦R
tTclErrorR§(RÊR2trgbtok((s./lib-tk/turtle.pyt_iscolorstringPs

cCs@|dk	r,|jjd|ƒ|jƒn|jjdƒSdS(sVSet canvas' backgroundcolor if color is not None,
        else return backgroundcolor.RûN(R¨RNR$RhR0(RÊR2((s./lib-tk/turtle.pyt_bgcolorZs
cCs°|\}}||j}||j}idd6dd6dd6}|jj|d|d|d	||d
|d|ƒ}	|jj|	ƒ\}
}}}
|jjƒ|	|dfS(sWrite txt at pos in canvas with specified font
        and color.
        Return text item and x-coord of right bottom corner
        of text's bounding box.tswRHR×tcentertseRWittexttanchorR:tfont(RORPRNtcreate_textR.R%(RÊRSttxttalignRvRORÈRÉRuRftx0ty0tx1ty1((s./lib-tk/turtle.pyt_writecs

'
icsYˆdkr&ˆjj|d|ƒn/‡‡fd†}ˆjj|d|||ƒdS(sÚBind fun to mouse-click event on turtle.
        fun must be a function with two arguments, the coordinates
        of the clicked point on the canvas.
        num, the number of the mouse-button defaults to 1
        s<Button-%s>csKˆjj|jƒˆjˆjj|jƒˆj}}ˆ||ƒdS(N(RNtcanvasxRÈROtcanvasyRÉRP(R-RÈRÉ(tfunRÊ(s./lib-tk/turtle.pyteventfun~s!N(R¨RNt
tag_unbindttag_bind(RÊRfRtnumtaddR‚((RRÊs./lib-tk/turtle.pyt_onclickuscsYˆdkr&ˆjj|d|ƒn/‡‡fd†}ˆjj|d|||ƒdS(sgBind fun to mouse-button-release event on turtle.
        fun must be a function with two arguments, the coordinates
        of the point on the canvas where mouse button is released.
        num, the number of the mouse-button defaults to 1

        If a turtle is clicked, first _onclick-event will be performed,
        then _onscreensclick-event.
        s<Button%s-ButtonRelease>csKˆjj|jƒˆjˆjj|jƒˆj}}ˆ||ƒdS(N(RNRRÈROR€RÉRP(R-RÈRÉ(RRÊ(s./lib-tk/turtle.pyR‚s!N(R¨RNRƒR„(RÊRfRR…R†R‚((RRÊs./lib-tk/turtle.pyt
_onrelease„s
	csYˆdkr&ˆjj|d|ƒn/‡‡fd†}ˆjj|d|||ƒdS(sqBind fun to mouse-move-event (with pressed mouse button) on turtle.
        fun must be a function with two arguments, the coordinates of the
        actual mouse position on the canvas.
        num, the number of the mouse-button defaults to 1

        Every sequence of mouse-move-events on a turtle is preceded by a
        mouse-click event on that turtle.
        s<Button%s-Motion>csYyKˆjj|jƒˆjˆjj|jƒˆj}}ˆ||ƒWnnXdS(N(RNRRÈROR€RÉRP(R-RÈRÉ(RRÊ(s./lib-tk/turtle.pyR‚£s!N(R¨RNRƒR„(RÊRfRR…R†R‚((RRÊs./lib-tk/turtle.pyt_ondrag—s	csSˆdkr#ˆjjd|ƒn,‡‡fd†}ˆjjd|||ƒdS(sGBind fun to mouse-click event on canvas.
        fun must be a function with two arguments, the coordinates
        of the clicked point on the canvas.
        num, the number of the mouse-button defaults to 1

        If a turtle is clicked, first _onclick-event will be performed,
        then _onscreensclick-event.
        s<Button-%s>csKˆjj|jƒˆjˆjj|jƒˆj}}ˆ||ƒdS(N(RNRRÈROR€RÉRP(R-RÈRÉ(RRÊ(s./lib-tk/turtle.pyR‚¸s!N(R¨RNR2R (RÊRR…R†R‚((RRÊs./lib-tk/turtle.pyt_onscreenclick¬s	csPˆdkr&|jjd|dƒn&‡fd†}|jjd||ƒdS(s`Bind fun to key-release event of key.
        Canvas must have focus. See method listen
        s<KeyRelease-%s>csˆƒdS(N((R-(R(s./lib-tk/turtle.pyR‚ÅsN(R¨RNR2R (RÊRR·R‚((Rs./lib-tk/turtle.pyt_onkey¾scCs|jjƒdS(s=Set focus on canvas (in order to collect key-events)
        N(RNR3(RÊ((s./lib-tk/turtle.pyt_listenÉscCs6|dkr|jj|ƒn|jj||ƒdS(s?Install a timer, which calls fun after t milliseconds.
        iN(RNt
after_idleRi(RÊRtt((s./lib-tk/turtle.pyt_ontimerÎscCs|jjddd|ƒS(s0Create and return image item on canvas.
        itimage(RNtcreate_image(RÊR((s./lib-tk/turtle.pyt_createimageÖscCsN|\}}|jj|||j||jfƒ|jj|d|ƒdS(sZConfigure image item as to draw image object
        at position (x,y) on canvas)
        RN(RNRWRORPt
itemconfig(RÊRft.2RRÈRÉ((s./lib-tk/turtle.pyt
_drawimageÛs	(cCs*|jj|d|ƒ|jj|ƒdS(s³Configure image item as to draw image object
        at center of canvas. Set item to the first item
        in the displaylist, so it will be drawn below
        any other item .RN(RNR“t	tag_lower(RÊRfR((s./lib-tk/turtle.pyt	_setbgpicâscCs|jj|ƒS(sQReturn 'line' or 'polygon' or 'image' depending on
        type of item.
        (RNRä(RÊRf((s./lib-tk/turtle.pyt_typeêscCsT|jj|ƒ}gtdt|ƒdƒD]}||||df^q+}|S(s returns list of coordinate-pairs of points of item
        Example (for insiders):
        >>> from turtle import *
        >>> getscreen()._pointlist(getturtle().turtle._item)
        [(0.0, 9.9999999999999982), (0.0, -9.9999999999999982),
        (9.9999999999999982, 0.0)]
        >>> iii(RNRWtrangetlen(RÊRfR]titpl((s./lib-tk/turtle.pyt
_pointlistðs>cCs#|jjd||||fƒdS(NR#(RNR$(RÊtsrx1tsry1tsrx2tsry2((s./lib-tk/turtle.pyt_setscrollregionüsc	Cs˜|jjƒ}x‚|D]z}|jj|ƒ}g}xF|r||d \}}|j||ƒ|j||ƒ|d}q7W|jj||ŒqWdS(Ni(RNtfind_allRWRV(	RÊtxscalefactortyscalefactorRãRftcoordinatestnewcoordlistRÈRÉ((s./lib-tk/turtle.pyt_rescaleÿs
	cCs©t|jtƒs"|j|jfS||koD|koDdknr_|jj|jjfS|dk	rw||_n|dk	r||_n|jj|||ƒdS(saResize the canvas the turtles are drawing on. Does
        not alter the drawing window.
        N(RÍRNRR’R“R¨RX(RÊR’R“Rû((s./lib-tk/turtle.pyt_resizes'cCs`|jjƒ}|dkr+|jd}n|jjƒ}|dkrV|jd}n||fS(s; Return the width and height of the turtle window.
        iRpR‘(RNR(R)(RÊRpR‘((s./lib-tk/turtle.pyt_window_sizesN(#RÛRÜRÝtstaticmethodRKRMRRUR¨R§R^RbRdRgRhRjRoRpR~R‡RˆR‰RŠR‹RŒRR’R•R—R˜RR¢R¨R©Rª(((s./lib-tk/turtle.pyRGâs@	
						
												cBseZdZRS(s¶Will be raised in TurtleScreen.update, if _RUNNING becomes False.

    This stops execution of a turtle graphics script.
    Main purpose: use in the Demo-Viewer turtle.Demo.py.
    (RÛRÜRÝ(((s./lib-tk/turtle.pyR+stTurtleGraphicsErrorcBseZdZRS(sSome TurtleGraphics Error
    (RÛRÜRÝ(((s./lib-tk/turtle.pyR¬4scBs&eZdZdd„Zdd„ZRS(sàData structure modeling shapes.

    attribute _type is one of "polygon", "image", "compound"
    attribute _data is - depending on _type a poygon-tuple,
    an image or a list constructed using the addcomponent method.
    cCs¼||_|dkr6t|tƒr¯t|ƒ}q¯ny|dkrŠt|tƒr¯|jƒjdƒr‡t|ƒr‡tj	|ƒ}q‡q¯n%|dkrŸg}nt
d|ƒ‚||_dS(NtpolygonRs.giftcompoundsThere is no shape type %s(R˜RÍRÞRÅt
basestringtlowertendswithRRRMR¬t_data(RÊttype_tdata((s./lib-tk/turtle.pyR@s	!	cCsW|jdkr%td|jƒ‚n|dkr:|}n|jj|||gƒdS(s-Add component to a shape of type compound.

        Arguments: poly is a polygon, i. e. a tuple of number pairs.
        fill is the fillcolor of the component,
        outline is the outline color of the component.

        call (for a Shapeobject namend s):
        --   s.addcomponent(((0,0), (10,10), (-10,10)), "red", "blue")

        Example:
        >>> poly = ((0,0),(10,-5),(0,10),(-10,-5))
        >>> s = Shape("compound")
        >>> s.addcomponent(poly, "red", "blue")
        >>> # .. add more components and then use register_shape()
        R®s Cannot add component to %s ShapeN(R˜R¬R¨R²RV(RÊtpolyR:RS((s./lib-tk/turtle.pytaddcomponentPs	N(RÛRÜRÝR¨RR¶(((s./lib-tk/turtle.pyR9stTbuffercBsJeZdZdd„Zdd„Zd„Zd„Zd„Zd„Z	RS(	s5Ring buffer used as undobuffer for RawTurtle objects.i
cCs2||_dgg||_d|_t|_dS(Niÿÿÿÿ(tbufsizeR¨tbuffertptrR§tcumulate(RÊR¸((s./lib-tk/turtle.pyRjs		cCsb|dkr9xFt|jƒD]}dg|j|<qWn||_dgg||_d|_dS(Niÿÿÿÿ(R¨R™R¸R¹Rº(RÊR¸R›((s./lib-tk/turtle.pyRXos	cCs`|jdkr\|jsB|jd|j|_||j|j<q\|j|jj|ƒndS(Nii(R¸R»RºR¹RV(RÊRf((s./lib-tk/turtle.pytpushws
	cCsd|jdkr`|j|j}|dkr/dSdg|j|j<|jd|j|_|SndS(Nii(R¸R¹RºR¨(RÊRf((s./lib-tk/turtle.pytpop~scCs|j|jjdgƒS(N(R¸R¹tcountR¨(RÊ((s./lib-tk/turtle.pytnr_of_items‡scCst|jƒdt|jƒS(Nt (tstrR¹Rº(RÊ((s./lib-tk/turtle.pyRډsN(
RÛRÜRÝRR¨RXR¼R½R¿RÚ(((s./lib-tk/turtle.pyR·hs				cBsOeZdZeZedededd„Zd„Zdd„Z	d„Z
dd„Zd	„Zd
„Z
dd„Zd„Zd
„Zd„Zddd„Zdd„Zd„Zd„Zd„Zd„Zd„Zd„Zddd„Zd„Zddd„Zdd„Zdd„Zdddd„ZeZ eZ!eZ"eZ#RS( sÏProvides screen oriented methods like setbg etc.

    Only relies upon the methods of TurtleScreenBase and NOT
    upon components of the underlying graphics toolkit -
    which is Tkinter in this case.
    RRRcCsƒitdd/d0d1fƒd6tdd2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIfƒd6tddJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]fƒd$6tdd^d_d`dafƒd%6tddbdcddfƒd(6tddedfdgdhfƒd)6td*|jƒƒd+6|_id,d-6|_tj||ƒ||_||_td.|_	g|_
|jƒdS(iNR­iöÿÿÿii
tarrowiiþÿÿÿiiÿÿÿÿiüÿÿÿiiùÿÿÿi	i÷ÿÿÿiiúÿÿÿiiiûÿÿÿiýÿÿÿiøÿÿÿiiiRžg…ëQ¸#@g¸…ëQ¸@g®Gáz. @g…ëQ¸…@g¸…ëQ¸Àg…ëQ¸…Àg®Gáz. Àg…ëQ¸#Àg€g$ÀR-tsquareg®GázÀgš™™™™'@ttriangleR˜RRIR»tnopicR(iöÿÿÿi(i
i(ii
(ii(iþÿÿÿi(iÿÿÿÿi
(iüÿÿÿi(iùÿÿÿi	(i÷ÿÿÿi(iúÿÿÿi(iùÿÿÿi(iûÿÿÿiýÿÿÿ(iøÿÿÿiúÿÿÿ(iúÿÿÿiøÿÿÿ(iüÿÿÿiûÿÿÿ(iiùÿÿÿ(iiûÿÿÿ(iiøÿÿÿ(iiúÿÿÿ(iiýÿÿÿ(ii(ii(i	i(ii	(ii(ii
(ii(i
i(g…ëQ¸#@g¸…ëQ¸@(g®Gáz. @g…ëQ¸…@(g…ëQ¸…@g®Gáz. @(g¸…ëQ¸@g…ëQ¸#@(ii
(g¸…ëQ¸Àg…ëQ¸#@(g…ëQ¸…Àg®Gáz. @(g®Gáz. Àg…ëQ¸…@(g…ëQ¸#Àg¸…ëQ¸@(iöÿÿÿi(g…ëQ¸#Àg¸…ëQ¸À(g®Gáz. Àg…ëQ¸…À(g…ëQ¸…Àg®Gáz. À(g¸…ëQ¸Àg…ëQ¸#À(g€g$À(g¸…ëQ¸@g…ëQ¸#À(g…ëQ¸…@g®Gáz. À(g®Gáz. @g…ëQ¸…À(g…ëQ¸#@g¸…ëQ¸À(i
iöÿÿÿ(i
i
(iöÿÿÿi
(iöÿÿÿiöÿÿÿ(i
g®GázÀ(igš™™™™'@(iöÿÿÿg®GázÀ(ii(iûÿÿÿi÷ÿÿÿ(iiùÿÿÿ(ii÷ÿÿÿ(RRKt_shapest_bgpicsRGRt_modet_delayvalueR½t
_colormodet_keysR.(RÊRNRRR((s./lib-tk/turtle.pyR˜s4
		

		
	cCs½td|_td|_|jdƒ|jdƒ|_d|_d|_d|_g|_	|j
dƒxdD]}|jd|ƒqqWx"|j
D]}|jd|ƒq–Wdt_dS(
sqDelete all drawings and all turtles from the TurtleScreen.

        Reset empty TurtleScreen to its initial state: white background,
        no backgroundimage, no eventbindings and tracing on.

        No argument.

        Example (for a TurtleScreen instance named screen):
        >>> screen.clear()

        Note: this method is not available as function.
        RRtallR»RÅiiRúiiN(iii(R½RÉRÊRgR’t_bgpict
_bgpicnamet_tracingt_updatecountert_turtlesRRJR¨RËRR	t_pen(RÊtbtnR·((s./lib-tk/turtle.pyR.¸s



				

cCs¨|dkr|jS|jƒ}|dkr>td|ƒ‚n||_|d	krš|j|jd|jd|jd|jdƒd|_|_n|j	ƒdS(
sgSet turtle-mode ('standard', 'logo' or 'world') and perform reset.

        Optional argument:
        mode -- on of the strings 'standard', 'logo' or 'world'

        Mode 'standard' is compatible with turtle.py.
        Mode 'logo' is compatible with most Logo-Turtle-Graphics.
        Mode 'world' uses userdefined 'worldcoordinates'. *Attention*: in
        this mode angles appear distorted if x/y unit-ratio doesn't equal 1.
        If mode is not given, return the current mode.

             Mode      Initial turtle heading     positive angles
         ------------|-------------------------|-------------------
          'standard'    to the right (east)       counterclockwise
            'logo'        upward    (north)         clockwise

        Examples:
        >>> mode('logo')   # resets turtle heading to north
        >>> mode()
        'logo'
        R–tlogotworldsNo turtle-graphics-mode %sigð?N(R–RÔRÕ(R–RÔ(
R¨RÈR°R¬R¢R’R“RORPRX(RÊR((s./lib-tk/turtle.pyRÔs	cCs|jƒdkr"|jdƒnt||ƒ}t||ƒ}|jƒ\}}|j|d|dƒ|j|j}	}
|j||_|j||_||j}||j}|j|}
|j|}|j|||
|ƒ|j	|j|	|j|
ƒ|j
ƒdS(ssSet up a user defined coordinate-system.

        Arguments:
        llx -- a number, x-coordinate of lower left corner of canvas
        lly -- a number, y-coordinate of lower left corner of canvas
        urx -- a number, x-coordinate of upper right corner of canvas
        ury -- a number, y-coordinate of upper right corner of canvas

        Set up user coodinat-system and switch to mode 'world' if necessary.
        This performs a screen.reset. If mode 'world' is already active,
        all drawings are redrawn according to the new coordinates.

        But ATTENTION: in user-defined coordinatesystems angles may appear
        distorted. (see Screen.mode())

        Example (for a TurtleScreen instance named screen):
        >>> screen.setworldcoordinates(-10,-0.5,50,1.5)
        >>> for _ in range(36):
        ...     left(10)
        ...     forward(0.5)
        RÕiN(RR°RªRRORPR’R“R¢R¨R%(RÊtllxtllyturxturytxspantyspantwxtwyt	oldxscalet	oldyscaleRžRŸR R¡((s./lib-tk/turtle.pyR!ös 


cCs|dkrO|jƒjdƒr<td|j|ƒƒ}qptddƒ‚n!t|tƒrptd|ƒ}n||j|<dS(s¥Adds a turtle shape to TurtleScreen's shapelist.

        Arguments:
        (1) name is the name of a gif-file and shape is None.
            Installs the corresponding image shape.
            !! Image-shapes DO NOT rotate when turning the turtle,
            !! so they do not display the heading of the turtle!
        (2) name is an arbitrary string and shape is a tuple
            of pairs of coordinates. Installs the corresponding
            polygon shape
        (3) name is an arbitrary string and shape is a
            (compound) Shape object. Installs the corresponding
            compound shape.
        To use a shape, you have to issue the command shape(shapename).

        call: register_shape("turtle.gif")
        --or: register_shape("tri", ((0,0), (10,10), (-10,10)))

        Example (for a TurtleScreen instance named screen):
        >>> screen.register_shape("triangle", ((5,-3),(0,5),(-5,-3)))

        s.gifRs"Bad arguments for register_shape.
sUse  help(register_shape)R­N(	R¨R°R±RRMR¬RÍRÅRÆ(RÊtnameRc((s./lib-tk/turtle.pyRs
cCs^t|ƒdkr|d}nt|tƒrf|j|ƒsI|dkrM|Stdt|ƒƒ‚ny|\}}}Wntdt|ƒƒ‚nX|jdkràg|||fD]}td|ƒ^q¸\}}}nd|ko÷dkno1d|kodkno1d|ko/dknsMtd	t|ƒƒ‚nd
|||fS(sReturn color string corresponding to args.

        Argument may be a string or a tuple of three
        numbers corresponding to actual colormode,
        i.e. in the range 0<=n<=colormode.

        If the argument doesn't represent a color,
        an error is raised.
        iiR»sbad color string: %ssbad color arguments: %sgð?gào@iÿsbad color sequence: %ss
#%02x%02x%02x(RšRÍR¯RoR¬RÁRÊtround(RÊR2R£tgtbRÈ((s./lib-tk/turtle.pyt	_colorstrAs

8TcCsÐ|jdƒs|St|ƒdkrUgdD] }t|||d!dƒ^q,}nSt|ƒdkr˜g|dD]}dt||dƒ^qr}ntd	|ƒ‚tg|D]}||jd
^q²ƒS(NR¤iiiiiiisbad colorstring: %siÿ(iii(R®RšR±R¬RÅRÊ(RÊtcstrR›R]RRRÖ((s./lib-tk/turtle.pyt_color\s01cCsS|dkr|jS|dkr1t|ƒ|_n|dkrOt|ƒ|_ndS(sqReturn the colormode or set it to 1.0 or 255.

        Optional argument:
        cmode -- one of the values 1.0 or 255

        r, g, b values of colortriples have to be in range 0..cmode.

        Example (for a TurtleScreen instance named screen):
        >>> screen.colormode()
        1.0
        >>> screen.colormode(255)
        >>> pencolor(240,160,80)
        gð?iÿN(R¨RÊR°R±(RÊtcmode((s./lib-tk/turtle.pyRgscCs2x+|jD] }|j|jƒ|jƒq
WdS(s®Reset all Turtles on the Screen to their initial state.

        No argument.

        Example (for a TurtleScreen instance named screen):
        >>> screen.reset()
        N(RÑt_setmodeRÈRX(RÊRž((s./lib-tk/turtle.pyRX|scCs|jS(s»Return the list of turtles on the screen.

        Example (for a TurtleScreen instance named screen):
        >>> screen.turtles()
        [<turtle.Turtle object at 0x00E11FB0>]
        (RÑ(RÊ((s./lib-tk/turtle.pyR$ˆscGsO|r|j|ƒ}nd}|j|ƒ}|dk	rK|j|ƒ}n|S(sŸSet or return backgroundcolor of the TurtleScreen.

        Arguments (if given): a color string or three numbers
        in the range 0..colormode or a 3-tuple of such numbers.

        Example (for a TurtleScreen instance named screen):
        >>> screen.bgcolor("orange")
        >>> screen.bgcolor()
        'orange'
        >>> screen.bgcolor(0.5,0,0.5)
        >>> screen.bgcolor()
        '#800080'
        N(RäR¨RpRæ(RÊR/R2((s./lib-tk/turtle.pyR‘scCsc|dkr|jSt|ƒ|_d|_|dk	rIt|ƒ|_n|jr_|jƒndS(seTurns turtle animation on/off and set delay for update drawings.

        Optional arguments:
        n -- nonnegative  integer
        delay -- nonnegative  integer

        If n is given, only each n-th regular screen update is really performed.
        (Can be used to accelerate the drawing of complex graphics.)
        Second arguments sets delay value (see RawTurtle.delay())

        Example (for a TurtleScreen instance named screen):
        >>> screen.tracer(8, 25)
        >>> dist = 2
        >>> for i in range(200):
        ...     fd(dist)
        ...     rt(90)
        ...     dist += 2
        iN(R¨RÏR±RÐRÉR%(RÊtnR((s./lib-tk/turtle.pyR#¨s		cCs&|dkr|jSt|ƒ|_dS(sø Return or set the drawing delay in milliseconds.

        Optional argument:
        delay -- positive integer

        Example (for a TurtleScreen instance named screen):
        >>> screen.delay(15)
        >>> screen.delay()
        15
        N(R¨RÉR±(RÊR((s./lib-tk/turtle.pyRÄscCsRtjstt_t‚n|jdkrN|jd7_|j|j;_ndS(sIncrement update counter.iiN(Rt_RUNNINGR¦RRÏRÐ(RÊ((s./lib-tk/turtle.pyt
_incrementudcÓs			cCsT|j}t|_x(|jƒD]}|jƒ|jƒqW||_|jƒdS(s'Perform a TurtleScreen update.
        N(RÏR¦R$t_update_datat_drawturtleRh(RÊttracingRŽ((s./lib-tk/turtle.pyR%Üs		
	cCs|jƒdS(s› Return the width of the turtle window.

        Example (for a TurtleScreen instance named screen):
        >>> screen.window_width()
        640
        i(Rª(RÊ((s./lib-tk/turtle.pyR'çscCs|jƒdS(s Return the height of the turtle window.

        Example (for a TurtleScreen instance named screen):
        >>> screen.window_height()
        480
        i(Rª(RÊ((s./lib-tk/turtle.pyR&ðscCs|jS(sçReturn the Canvas of this TurtleScreen.

        No argument.

        Example (for a Screen instance named screen):
        >>> cv = screen.getcanvas()
        >>> cv
        <turtle.ScrolledCanvas instance at 0x010742D8>
        (RN(RÊ((s./lib-tk/turtle.pyRùs
cCst|jjƒƒS(sðReturn a list of names of all currently available turtle shapes.

        No argument.

        Example (for a TurtleScreen instance named screen):
        >>> screen.getshapes()
        ['arrow', 'blank', 'circle', ... , 'turtle']
        (tsortedRÆRê(RÊ((s./lib-tk/turtle.pyRs	icCs|j|||ƒdS(sBind fun to mouse-click event on canvas.

        Arguments:
        fun -- a function with two arguments, the coordinates of the
               clicked point on the canvas.
        num -- the number of the mouse-button, defaults to 1

        Example (for a TurtleScreen instance named screen
        and a Turtle instance named turtle):

        >>> screen.onclick(goto)
        >>> # Subsequently clicking into the TurtleScreen will
        >>> # make the turtle move to the clicked point.
        >>> screen.onclick(None)
        N(RŠ(RÊRRÓR†((s./lib-tk/turtle.pyRJscCsg|dkr1||jkrS|jj|ƒqSn"||jkrS|jj|ƒn|j||ƒdS(smBind fun to key-release event of key.

        Arguments:
        fun -- a function with no arguments
        key -- a string: key (e.g. "a") or key-symbol (e.g. "space")

        In order to be able to register key-events, TurtleScreen
        must have focus. (See method listen.)

        Example (for a TurtleScreen instance named screen):

        >>> def f():
        ...     fd(50)
        ...     lt(60)
        ...
        >>> screen.onkey(f, "Up")
        >>> screen.listen()

        Subsequently the turtle can be moved by repeatedly pressing
        the up-arrow key, consequently drawing a hexagon

        N(R¨RËtremoveRVR‹(RÊRR·((s./lib-tk/turtle.pyR"scCs|jƒdS(sSet focus on TurtleScreen (in order to collect key-events)

        No arguments.
        Dummy arguments are provided in order
        to be able to pass listen to the onclick method.

        Example (for a TurtleScreen instance named screen):
        >>> screen.listen()
        N(RŒ(RÊtxdummytydummy((s./lib-tk/turtle.pyR@s
icCs|j||ƒdS(sïInstall a timer, which calls fun after t milliseconds.

        Arguments:
        fun -- a function with no arguments.
        t -- a number >= 0

        Example (for a TurtleScreen instance named screen):

        >>> running = True
        >>> def f():
        ...     if running:
        ...             fd(50)
        ...             lt(60)
        ...             screen.ontimer(f, 250)
        ...
        >>> f()   # makes the turtle marching around
        >>> running = False
        N(R(RÊRRŽ((s./lib-tk/turtle.pyRLscCsb|dkr|jS||jkr;|j|ƒ|j|<n|j|j|j|ƒ||_dS(sFSet background image or return name of current backgroundimage.

        Optional argument:
        picname -- a string, name of a gif-file or "nopic".

        If picname is a filename, set the corresponding image as background.
        If picname is "nopic", delete backgroundimage, if present.
        If picname is None, return the filename of the current backgroundimage.

        Example (for a TurtleScreen instance named screen):
        >>> screen.bgpic()
        'nopic'
        >>> screen.bgpic("landscape.gif")
        >>> screen.bgpic()
        'landscape.gif'
        N(R¨RÎRÇRMR—RÍ(RÊtpicname((s./lib-tk/turtle.pyRascCs|j|||ƒS(s×Resize the canvas the turtles are drawing on.

        Optional arguments:
        canvwidth -- positive integer, new width of canvas in pixels
        canvheight --  positive integer, new height of canvas in pixels
        bg -- colorstring or color-tuple, new backgroundcolor
        If no arguments are given, return current (canvaswidth, canvasheight)

        Do not alter the drawing window. To observe hidden parts of
        the canvas use the scrollbars. (Can make visible those parts
        of a drawing, which were outside the canvas before!)

        Example (for a Turtle instance named turtle):
        >>> turtle.screensize(2000,1500)
        >>> # e. g. to search for an erroneously escaped turtle ;-)
        (R©(RÊR’R“Rû((s./lib-tk/turtle.pyRysN($RÛRÜRÝR¦RêR½RR.R¨RR!RRäRæRRXR$RR#RRëR%R'R&RRRJRRRRRRRRR(((s./lib-tk/turtle.pyRŽs@	"	'$																t
TNavigatorcBs¬eZdZieddƒd6eddƒd6eddƒd6ZdZdZdZed„Zd	„Z	d%d
„Zd„Zdd
„Z
d„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd%d„Zd„Zd„Zd„Zd%d„Zd%d„Zd„Zd „Z d%d%d!„Z!dd"„Z"d%d%d#„Z#d%d$„Z$eZ%eZ&eZ'eZ(eZ)eZ*eZ+eZ,e Z-RS(&sRNavigation part of the RawTurtle.
    Implements methods for turtle movement.
    gð?gR–RÕRÔiicCs[|j|_|j|_||_d|_|jƒd|_|j|ƒt	j
|ƒdS(N(tDEFAULT_ANGLEOFFSETt_angleOffsettDEFAULT_ANGLEORIENTt_angleOrientRÈR¨t
undobufferR3RèRôRX(RÊR((s./lib-tk/turtle.pyRs		
	
cCs)tddƒ|_tj|j|_dS(sXreset turtle to its initial values

        Will be overwritten by parent class
        gN(R
t	_positionRôtSTART_ORIENTATIONRÈt_orient(RÊ((s./lib-tk/turtle.pyRX§scCsj|dkr|jS|d	kr#dS||_|d
krMd|_d|_n|jd|_d|_dS(s:Set turtle-mode to 'standard', 'world' or 'logo'.
        R–RÔRÕNiig@iÿÿÿÿ(sstandardslogosworld(sstandardsworld(R¨RÈRöRøt_fullcircle(RÊR((s./lib-tk/turtle.pyRè¯s		cCsB||_d||_|jdkr1d|_n
|d|_dS(s+Helper function for degrees() and radians()ihR–ig@N(Rýt
_degreesPerAURÈRö(RÊt
fullcircle((s./lib-tk/turtle.pyt_setDegreesPerAU¾s
	
g€v@cCs|j|ƒdS(s> Set angle measurement units to degrees.

        Optional argument:
        fullcircle -  a number

        Set angle measurement units, i. e. set number
        of 'degrees' for a full circle. Dafault value is
        360 degrees.

        Example (for a Turtle instance named turtle):
        >>> turtle.left(90)
        >>> turtle.heading()
        90

        Change angle measurement unit to grad (also known as gon,
        grade, or gradian and equals 1/100-th of the right angle.)
        >>> turtle.degrees(400.0)
        >>> turtle.heading()
        100

        N(R(RÊRÿ((s./lib-tk/turtle.pyR3ÇscCs|jdtjƒdS(s Set the angle measurement units to radians.

        No arguments.

        Example (for a Turtle instance named turtle):
        >>> turtle.heading()
        90
        >>> turtle.radians()
        >>> turtle.heading()
        1.5707963267948966
        iN(RRÓR‰(RÊ((s./lib-tk/turtle.pyRVßscCs%|j|j|}|j|ƒdS(s)move turtle forward by specified distanceN(RúRüt_goto(RÊR4tende((s./lib-tk/turtle.pyt_goíscCs&||j9}|jj|ƒ|_dS(s=Turn turtle counterclockwise by specified angle if angle > 0.N(RþRüRØ(RÊRÔ((s./lib-tk/turtle.pyt_rotateòs
cCs
||_dS(smove turtle to position end.N(Rú(RÊtend((s./lib-tk/turtle.pyR÷scCs|j|ƒdS(sMove the turtle forward by the specified distance.

        Aliases: forward | fd

        Argument:
        distance -- a number (integer or float)

        Move the turtle forward by the specified distance, in the direction
        the turtle is headed.

        Example (for a Turtle instance named turtle):
        >>> turtle.position()
        (0.00, 0.00)
        >>> turtle.forward(25)
        >>> turtle.position()
        (25.00,0.00)
        >>> turtle.forward(-75)
        >>> turtle.position()
        (-50.00,0.00)
        N(R(RÊR4((s./lib-tk/turtle.pyR<ûscCs|j|ƒdS(sÏMove the turtle backward by distance.

        Aliases: back | backward | bk

        Argument:
        distance -- a number

        Move the turtle backward by distance ,opposite to the direction the
        turtle is headed. Do not change the turtle's heading.

        Example (for a Turtle instance named turtle):
        >>> turtle.position()
        (0.00, 0.00)
        >>> turtle.backward(30)
        >>> turtle.position()
        (-30.00, 0.00)
        N(R(RÊR4((s./lib-tk/turtle.pyR(scCs|j|ƒdS(sôTurn turtle right by angle units.

        Aliases: right | rt

        Argument:
        angle -- a number (integer or float)

        Turn turtle right by angle units. (Units are by default degrees,
        but can be set via the degrees() and radians() functions.)
        Angle orientation depends on mode. (See this.)

        Example (for a Turtle instance named turtle):
        >>> turtle.heading()
        22.0
        >>> turtle.right(45)
        >>> turtle.heading()
        337.0
        N(R(RÊRÔ((s./lib-tk/turtle.pyRW&scCs|j|ƒdS(sïTurn turtle left by angle units.

        Aliases: left | lt

        Argument:
        angle -- a number (integer or float)

        Turn turtle left by angle units. (Units are by default degrees,
        but can be set via the degrees() and radians() functions.)
        Angle orientation depends on mode. (See this.)

        Example (for a Turtle instance named turtle):
        >>> turtle.heading()
        22.0
        >>> turtle.left(45)
        >>> turtle.heading()
        67.0
        N(R(RÊRÔ((s./lib-tk/turtle.pyRH;scCs|jS(sæReturn the turtle's current location (x,y), as a Vec2D-vector.

        Aliases: pos | position

        No arguments.

        Example (for a Turtle instance named turtle):
        >>> turtle.pos()
        (0.00, 240.00)
        (Rú(RÊ((s./lib-tk/turtle.pyRSPscCs|jdS(sö Return the turtle's x coordinate.

        No arguments.

        Example (for a Turtle instance named turtle):
        >>> reset()
        >>> turtle.left(60)
        >>> turtle.forward(100)
        >>> print turtle.xcor()
        50.0
        i(Rú(RÊ((s./lib-tk/turtle.pyRr]scCs|jdS(s	 Return the turtle's y coordinate
        ---
        No arguments.

        Example (for a Turtle instance named turtle):
        >>> reset()
        >>> turtle.left(60)
        >>> turtle.forward(100)
        >>> print turtle.ycor()
        86.6025403784
        i(Rú(RÊ((s./lib-tk/turtle.pyRskscCs<|dkr"|jt|Œƒn|jt||ƒƒdS(stMove turtle to an absolute position.

        Aliases: setpos | setposition | goto:

        Arguments:
        x -- a number      or     a pair/vector of numbers
        y -- a number             None

        call: goto(x, y)         # two coordinates
        --or: goto((x, y))       # a pair (tuple) of coordinates
        --or: goto(vec)          # e.g. as returned by pos()

        Move turtle to an absolute position. If the pen is down,
        a line will be drawn. The turtle's orientation does not change.

        Example (for a Turtle instance named turtle):
        >>> tp = turtle.pos()
        >>> tp
        (0.00, 0.00)
        >>> turtle.setpos(60,30)
        >>> turtle.pos()
        (60.00,30.00)
        >>> turtle.setpos((20,80))
        >>> turtle.pos()
        (20.00,80.00)
        >>> turtle.setpos(tp)
        >>> turtle.pos()
        (0.00,0.00)
        N(R¨RR
(RÊRÈRÉ((s./lib-tk/turtle.pyRAzscCs!|jddƒ|jdƒdS(s$Move turtle to the origin - coordinates (0,0).

        No arguments.

        Move turtle to the origin - coordinates (0,0) and set its
        heading to its start-orientation (which depends on mode).

        Example (for a Turtle instance named turtle):
        >>> turtle.home()
        iN(RAR\(RÊ((s./lib-tk/turtle.pyRDscCs!|jt||jdƒƒdS(s…Set the turtle's first coordinate to x

        Argument:
        x -- a number (integer or float)

        Set the turtle's first coordinate to x, leave second coordinate
        unchanged.

        Example (for a Turtle instance named turtle):
        >>> turtle.position()
        (0.00, 240.00)
        >>> turtle.setx(10)
        >>> turtle.position()
        (10.00, 240.00)
        iN(RR
Rú(RÊRÈ((s./lib-tk/turtle.pyRa«scCs!|jt|jd|ƒƒdS(s‡Set the turtle's second coordinate to y

        Argument:
        y -- a number (integer or float)

        Set the turtle's first coordinate to x, second coordinate remains
        unchanged.

        Example (for a Turtle instance named turtle):
        >>> turtle.position()
        (0.00, 40.00)
        >>> turtle.sety(-10)
        >>> turtle.position()
        (0.00, -10.00)
        iN(RR
Rú(RÊRÉ((s./lib-tk/turtle.pyRb½scCs€|dk	rt||ƒ}nt|tƒr6|}n9t|tƒrTt|Œ}nt|tƒro|j}nt||jƒS(sëReturn the distance from the turtle to (x,y) in turtle step units.

        Arguments:
        x -- a number   or  a pair/vector of numbers   or   a turtle instance
        y -- a number       None                            None

        call: distance(x, y)         # two coordinates
        --or: distance((x, y))       # a pair (tuple) of coordinates
        --or: distance(vec)          # e.g. as returned by pos()
        --or: distance(mypen)        # where mypen is another turtle

        Example (for a Turtle instance named turtle):
        >>> turtle.pos()
        (0.00, 0.00)
        >>> turtle.distance(30,40)
        50.0
        >>> pen = Turtle()
        >>> pen.forward(77)
        >>> turtle.distance(pen)
        77.0
        N(R¨R
RÍRÅRôRútabs(RÊRÈRÉRS((s./lib-tk/turtle.pyR4Ïs	cCsÒ|dk	rt||ƒ}nt|tƒr6|}n9t|tƒrTt|Œ}nt|tƒro|j}n||j\}}ttj||ƒdtj	dƒd}||j
:}|j|j||j
S(sCReturn the angle of the line from the turtle's position to (x, y).

        Arguments:
        x -- a number   or  a pair/vector of numbers   or   a turtle instance
        y -- a number       None                            None

        call: distance(x, y)         # two coordinates
        --or: distance((x, y))       # a pair (tuple) of coordinates
        --or: distance(vec)          # e.g. as returned by pos()
        --or: distance(mypen)        # where mypen is another turtle

        Return the angle, between the line from turtle-position to position
        specified by x, y and the turtle's start orientation. (Depends on
        modes - "standard" or "logo")

        Example (for a Turtle instance named turtle):
        >>> turtle.pos()
        (10.00, 10.00)
        >>> turtle.towards(0,0)
        225.0
        g€f@i
g€v@N(R¨R
RÍRÅRôRúRáRÓRzR‰RþRöRøRý(RÊRÈRÉRStresult((s./lib-tk/turtle.pyRkïs	*
cCs_|j\}}ttj||ƒdtjdƒd}||j:}|j|j||jS(s Return the turtle's current heading.

        No arguments.

        Example (for a Turtle instance named turtle):
        >>> turtle.left(67)
        >>> turtle.heading()
        67.0
        g€f@i
g€v@(	RüRáRÓRzR‰RþRöRøRý(RÊRÈRÉR((s./lib-tk/turtle.pyRBs
*
cCsK||jƒ|j}|j}||d||d}|j|ƒdS(sžSet the orientation of the turtle to to_angle.

        Aliases:  setheading | seth

        Argument:
        to_angle -- a number (integer or float)

        Set the orientation of the turtle to to_angle.
        Here are some common directions in degrees:

         standard - mode:          logo-mode:
        -------------------|--------------------
           0 - east                0 - north
          90 - north              90 - east
         180 - west              180 - south
         270 - south             270 - west

        Example (for a Turtle instance named turtle):
        >>> turtle.setheading(90)
        >>> turtle.heading()
        90
        g@N(RBRøRýR(RÊtto_angleRÔtfull((s./lib-tk/turtle.pyR\!s	cCsõ|jr+|jjdgƒt|j_n|jƒ}|dkrO|j}n|dkrœt|ƒ|j}dtt	dt|ƒddƒ|ƒ}nd||}d|}d|t
j|t
jd	|j
ƒ}|d
kr|||}}}n|jƒ}	|jƒ}
|d
kr:|jd
d
ƒn
|jd
ƒ|j|ƒxHt|ƒD]:}|j|ƒ|j|ƒ|jd
ƒ|j|ƒqaW|j|ƒ|d
krÌ|j|	|
ƒn|j|ƒ|jrñt|j_ndS(së Draw a circle with given radius.

        Arguments:
        radius -- a number
        extent (optional) -- a number
        steps (optional) -- an integer

        Draw a circle with given radius. The center is radius units left
        of the turtle; extent - an angle - determines which part of the
        circle is drawn. If extent is not given, draw the entire circle.
        If extent is not a full circle, one endpoint of the arc is the
        current pen position. Draw the arc in counterclockwise direction
        if radius is positive, otherwise in clockwise direction. Finally
        the direction of the turtle is changed by the amount of extent.

        As the circle is approximated by an inscribed regular polygon,
        steps determines the number of steps to use. If not given,
        it will be calculated automatically. Maybe used to draw regular
        polygons.

        call: circle(radius)                  # full circle
        --or: circle(radius, extent)          # arc
        --or: circle(radius, extent, steps)
        --or: circle(radius, steps=6)         # 6-sided polygon

        Example (for a Turtle instance named turtle):
        >>> turtle.circle(50)
        >>> turtle.circle(120, 180)  # semicircle
        tseqiig@g€M@gð?gà?g@g€f@iN(RùR¼R¦R»RfR¨RýRR±tminRÓR‹R‰RþR#RjRR™RR§(RÊtradiustextenttstepsRftfracRQtw2tlttrtdlR›((s./lib-tk/turtle.pyR-=s>	.
)





	cCsdS(s/dummy method - to be overwritten by child classN((RÊR×((s./lib-tk/turtle.pyRf~scCsdS(s/dummy method - to be overwritten by child classN((RÊtaRã((s./lib-tk/turtle.pyR#€scCsdS(s/dummy method - to be overwritten by child classN((RÊRé((s./lib-tk/turtle.pyRj‚sN(.RÛRÜRÝR
RûtDEFAULT_MODERõR÷RRXR¨RèRR3RVRRRR<R(RWRHRSRrRsRARDRaRbR4RkRBR\R-RfR#RjR9R,R)RZRIRTR]R^R[(((s./lib-tk/turtle.pyRô‘sZ
												
		#			 #		AtTPencBs
eZdZedd„Zededd„Zdd„Zdd„Zd„Z	d	„Z
d
„Zdd„Zd„Z
d
„Zd„Zd„Zd„Zd„Zdd„Zed„Zeed„Zd„Zd„ZeZe	Ze	Ze
Ze
ZeZeZ RS(sFDrawing part of the RawTurtle.
    Implements drawing properties.
    RYcCs#||_d|_tj|ƒdS(N(t_resizemodeR¨RùRt_reset(RÊRY((s./lib-tk/turtle.pyR”s		ROR;cCsUd|_t|_||_||_t|_d|_d|_d|_d|_	dS(Niii(ii(
t_pensizeR¦t_shownt	_pencolort
_fillcolort_drawingt_speedt_stretchfactort_tiltt
_outlinewidth(RÊROR;((s./lib-tk/turtle.pyR™s								cCsB|dkr|jS|jƒ}|dkr>|jd|ƒndS(szSet resizemode to one of the values: "auto", "user", "noresize".

        (Optional) Argument:
        rmode -- one of the strings "auto", "user", "noresize"

        Different resizemodes have the following effects:
          - "auto" adapts the appearance of the turtle
                   corresponding to the value of pensize.
          - "user" adapts the appearance of the turtle according to the
                   values of stretchfactor and outlinewidth (outline),
                   which are set by shapesize()
          - "noresize" no adaption of the turtle's appearance takes place.
        If no argument is given, return current resizemode.
        resizemode("user") is called by a call of shapesize with arguments.


        Examples (for a Turtle instance named turtle):
        >>> turtle.resizemode("noresize")
        >>> turtle.resizemode()
        'noresize'
        tautotuserRšRYN(R"R#Rš(R¨RR°RN(RÊtrmode((s./lib-tk/turtle.pyRY¦s
cCs'|dkr|jS|jd|ƒdS(s!Set or return the line thickness.

        Aliases:  pensize | width

        Argument:
        width -- positive number

        Set the line thickness to width or return it. If resizemode is set
        to "auto" and turtleshape is a polygon, that polygon is drawn with
        the same line thickness. If no argument is given, current pensize
        is returned.

        Example (for a Turtle instance named turtle):
        >>> turtle.pensize()
        1
        >>> turtle.pensize(10)   # from here on lines of width 10 are drawn
        RQN(R¨RRN(RÊRp((s./lib-tk/turtle.pyRQÂscCs!|js
dS|jdtƒdS(s¼Pull the pen up -- no drawing when moving.

        Aliases: penup | pu | up

        No argument

        Example (for a Turtle instance named turtle):
        >>> turtle.penup()
        NRP(RRNR§(RÊ((s./lib-tk/turtle.pyRRÙs
	cCs!|jr
dS|jdtƒdS(sÂPull the pen down -- drawing when moving.

        Aliases: pendown | pd | down

        No argument.

        Example (for a Turtle instance named turtle):
        >>> turtle.pendown()
        NRP(RRNR¦(RÊ((s./lib-tk/turtle.pyRPçs
	cCs|jS(sReturn True if pen is down, False if it's up.

        No argument.

        Example (for a Turtle instance named turtle):
        >>> turtle.penup()
        >>> turtle.isdown()
        False
        >>> turtle.pendown()
        >>> turtle.isdown()
        True
        (R(RÊ((s./lib-tk/turtle.pyRFõs
cCs idd6dd6dd6dd6d	d
6}|dkr<|jS||krU||}n7d|koldknr†tt|ƒƒ}nd}|jd
|ƒdS(s¤ Return or set the turtle's speed.

        Optional argument:
        speed -- an integer in the range 0..10 or a speedstring (see below)

        Set the turtle's speed to an integer value in the range 0 .. 10.
        If no argument is given: return current speed.

        If input is a number greater than 10 or smaller than 0.5,
        speed is set to 0.
        Speedstrings  are mapped to speedvalues in the following way:
            'fastest' :  0
            'fast'    :  10
            'normal'  :  6
            'slow'    :  3
            'slowest' :  1
        speeds from 1 to 10 enforce increasingly faster animation of
        line drawing and turtle turning.

        Attention:
        speed = 0 : *no* animation takes place. forward/back makes turtle jump
        and likewise left/right make the turtle turn instantly.

        Example (for a Turtle instance named turtle):
        >>> turtle.speed(3)
        itfastesti
tfastitnormalitslowitslowestgà?g%@RfN(R¨RR±RáRN(RÊRftspeeds((s./lib-tk/turtle.pyRfs)
cGsÀ|ršt|ƒ}|dkr/|d}}n4|dkrJ|\}}n|dkrc|}}n|j|ƒ}|j|ƒ}|jd|d|ƒn"|j|jƒ|j|jƒfSdS(sšReturn or set the pencolor and fillcolor.

        Arguments:
        Several input formats are allowed.
        They use 0, 1, 2, or 3 arguments as follows:

        color()
            Return the current pencolor and the current fillcolor
            as a pair of color specification strings as are returned
            by pencolor and fillcolor.
        color(colorstring), color((r,g,b)), color(r,g,b)
            inputs as in pencolor, set both, fillcolor and pencolor,
            to the given value.
        color(colorstring1, colorstring2),
        color((r1,g1,b1), (r2,g2,b2))
            equivalent to pencolor(colorstring1) and fillcolor(colorstring2)
            and analogously, if the other input format is used.

        If turtleshape is a polygon, outline and interior of that polygon
        is drawn with the newly set colors.
        For mor info see: pencolor, fillcolor

        Example (for a Turtle instance named turtle):
        >>> turtle.color('red', 'green')
        >>> turtle.color()
        ('red', 'green')
        >>> colormode(255)
        >>> color((40, 80, 120), (160, 200, 240))
        >>> color()
        ('#285078', '#a0c8f0')
        iiiiROR;N(RšRäRNRæRR(RÊR/Rtpcolortfcolor((s./lib-tk/turtle.pyR2*s 
cGsO|r;|j|ƒ}||jkr(dS|jd|ƒn|j|jƒSdS(sZ Return or set the pencolor.

        Arguments:
        Four input formats are allowed:
          - pencolor()
            Return the current pencolor as color specification string,
            possibly in hex-number format (see example).
            May be used as input to another color/pencolor/fillcolor call.
          - pencolor(colorstring)
            s is a Tk color specification string, such as "red" or "yellow"
          - pencolor((r, g, b))
            *a tuple* of r, g, and b, which represent, an RGB color,
            and each of r, g, and b are in the range 0..colormode,
            where colormode is either 1.0 or 255
          - pencolor(r, g, b)
            r, g, and b represent an RGB color, and each of r, g, and b
            are in the range 0..colormode

        If turtleshape is a polygon, the outline of that polygon is drawn
        with the newly set pencolor.

        Example (for a Turtle instance named turtle):
        >>> turtle.pencolor('brown')
        >>> tup = (0.2, 0.8, 0.55)
        >>> turtle.pencolor(tup)
        >>> turtle.pencolor()
        '#33cc8c'
        NRO(RäRRNRæ(RÊR/R2((s./lib-tk/turtle.pyROXscGsO|r;|j|ƒ}||jkr(dS|jd|ƒn|j|jƒSdS(s] Return or set the fillcolor.

        Arguments:
        Four input formats are allowed:
          - fillcolor()
            Return the current fillcolor as color specification string,
            possibly in hex-number format (see example).
            May be used as input to another color/pencolor/fillcolor call.
          - fillcolor(colorstring)
            s is a Tk color specification string, such as "red" or "yellow"
          - fillcolor((r, g, b))
            *a tuple* of r, g, and b, which represent, an RGB color,
            and each of r, g, and b are in the range 0..colormode,
            where colormode is either 1.0 or 255
          - fillcolor(r, g, b)
            r, g, and b represent an RGB color, and each of r, g, and b
            are in the range 0..colormode

        If turtleshape is a polygon, the interior of that polygon is drawn
        with the newly set fillcolor.

        Example (for a Turtle instance named turtle):
        >>> turtle.fillcolor('violet')
        >>> col = turtle.pencolor()
        >>> turtle.fillcolor(col)
        >>> turtle.fillcolor(0, .5, 0)
        NR;(RäRRNRæ(RÊR/R2((s./lib-tk/turtle.pyR;}scCs|jdtƒdS(sÑMakes the turtle visible.

        Aliases: showturtle | st

        No argument.

        Example (for a Turtle instance named turtle):
        >>> turtle.hideturtle()
        >>> turtle.showturtle()
        tshownN(RNR¦(RÊ((s./lib-tk/turtle.pyRe¡scCs|jdtƒdS(sYMakes the turtle invisible.

        Aliases: hideturtle | ht

        No argument.

        It's a good idea to do this while you're in the
        middle of a complicated drawing, because hiding
        the turtle speeds up the drawing observably.

        Example (for a Turtle instance named turtle):
        >>> turtle.hideturtle()
        R-N(RNR§(RÊ((s./lib-tk/turtle.pyRC®scCs|jS(sãReturn True if the Turtle is shown, False if it's hidden.

        No argument.

        Example (for a Turtle instance named turtle):
        >>> turtle.hideturtle()
        >>> print turtle.isvisible():
        False
        (R(RÊ((s./lib-tk/turtle.pyRG¾s
c	Ks6i
|jd6|jd6|jd6|jd6|jd6|jd6|jd6|jd6|jd	6|j	d
6}|ps|sz|St
|tƒr’|}ni}|j|ƒi}x|D]}||||<q²W|j
rì|j
jd|fƒnt}d|kr|j|dkrt}qnd|krxt
|dtƒrY|j|dfƒ|d<n|j|dkrxt}qxnd|kr£|j|dkr£t}q£n|r¶|jƒnd|krÒ|d|_nd|krî|d|_nd|kr
|d|_nd|krVt
|dtƒrF|j|dfƒ|d<n|d|_nd|krr|d|_nd|krŽ|d|_nd|krÔ|d}t
|ttfƒrÈ||f}n||_nd	|krð|d	|_nd|kr|d|_nd
|kr(|d
|_	n|jƒdS(
síReturn or set the pen's attributes.

        Arguments:
            pen -- a dictionary with some or all of the below listed keys.
            **pendict -- one or more keyword-arguments with the below
                         listed keys as keywords.

        Return or set the pen's attributes in a 'pen-dictionary'
        with the following key/value pairs:
           "shown"      :   True/False
           "pendown"    :   True/False
           "pencolor"   :   color-string or color-tuple
           "fillcolor"  :   color-string or color-tuple
           "pensize"    :   positive number
           "speed"      :   number in range 0..10
           "resizemode" :   "auto" or "user" or "noresize"
           "stretchfactor": (positive number, positive number)
           "outline"    :   positive number
           "tilt"       :   number

        This dictionary can be used as argument for a subsequent
        pen()-call to restore the former pen-state. Moreover one
        or more of these attributes can be provided as keyword-arguments.
        This can be used to set several pen attributes in one statement.


        Examples (for a Turtle instance named turtle):
        >>> turtle.pen(fillcolor="black", pencolor="red", pensize=10)
        >>> turtle.pen()
        {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
        'pencolor': 'red', 'pendown': True, 'fillcolor': 'black',
        'stretchfactor': (1,1), 'speed': 3}
        >>> penstate=turtle.pen()
        >>> turtle.color("yellow","")
        >>> turtle.penup()
        >>> turtle.pen()
        {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
        'pencolor': 'yellow', 'pendown': False, 'fillcolor': '',
        'stretchfactor': (1,1), 'speed': 3}
        >>> p.pen(penstate, fillcolor="green")
        >>> p.pen()
        {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
        'pencolor': 'red', 'pendown': True, 'fillcolor': 'green',
        'stretchfactor': (1,1), 'speed': 3}
        R-RPROR;RQRfRYt
stretchfactorRSRiRNN(RRRRRRRRR!R RÍtdictR%RùR¼R§R¦RÅRät_newLineR±R°Rh(	RÊRNtpendictt_pdtpt_p_bufR·tnewLinetsf((s./lib-tk/turtle.pyRNÊsz.









	

	

cCsdS(s/dummy method - to be overwritten by child classN((RÊtusePos((s./lib-tk/turtle.pyR0?	scCsdS(s/dummy method - to be overwritten by child classN((RÊR¾tforced((s./lib-tk/turtle.pyRhA	scCsdS(s/dummy method - to be overwritten by child classN((RÊR/((s./lib-tk/turtle.pyRæC	scCsdS(s/dummy method - to be overwritten by child classN((RÊR/((s./lib-tk/turtle.pyRäE	sN(!RÛRÜRÝR½RRR¨RYRQRRRPRFRfR2ROR;ReRCRGRNR¦R0R§RhRæRäRpRoRURMR6RgRE(((s./lib-tk/turtle.pyRs8			&	.	%	$	
		u		t_TurtleImagecBs eZdZd„Zd„ZRS(s6Helper class: Datatype to store Turtle attributes
    cCs#||_d|_|j|ƒdS(N(R R¨R˜t	_setshape(RÊR t
shapeIndex((s./lib-tk/turtle.pyRU	s		cCse|j}||_|jdko6|j|jknr?dS|jdkoc|j|jknrldS|jdkrŽ|j|jƒn3|jdkrÁx!|jD]}|j|ƒq§Wn|j|j|_|jdkrõ|jƒ|_nl|jdkr#|j|jdjƒ|_n>|jdkrag|j|jD]}|jƒ^qC|_ndS(NR­RR®RI(simagespolygon(	R R;R˜RÆRgt_itemRUR’R²(RÊR;R Rf((s./lib-tk/turtle.pyR:Z	s&		))(RÛRÜRÝRR:(((s./lib-tk/turtle.pyR9Q	s	cBseZdZgZd8edededd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Zd„Z
d8d8d„Zd
„Zd„Zd„Zd„Zd8d„Zd8d8d8d„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd8d„Zd„Zd„Zd„Z e!d„Z"d8d „Z#d!„Z$d"„Z%d8d#„Z&d$„Z'e(d%d9d)„Z)d*„Z*d+„Z+d,„Z,d-„Z-d.„Z.e.Z/d/„Z0d0„Z1d8d1„Z2d2d8d3„Z3d2d8d4„Z4d2d8d5„Z5d6„Z6d7„Z7eZ8RS(:svAnimation part of the RawTurtle.
    Puts RawTurtle upon a TurtleScreen and provides tools for
    its animation.
    RcR—R›cCs¿t|tƒr||_n·t|tƒrX|tjkrLtjj|ƒn||_nzt|ttfƒrÂxbtjD]"}|j	|krw||_PqwqwWt|ƒ|_tjj|jƒnt
d|ƒ‚|j}tj||j
ƒƒtj|ƒ|jj|ƒ|jƒ|_t||ƒ|_d|_t|_d|_|_||_t|_|jƒ|_|jg|_|jg|_g|_ ||_!t"|ƒ|_#|j$ƒdS(Nsbad canvas argument %s(%RÍt_ScreenR RRtscreensRVRRRNR¬RôRRRRÑRbtdrawingLineItemR9RžR¨t_polyR§t
_creatingPolyt	_fillitemt	_fillpathRt_hidden_from_screentcurrentLineItemRútcurrentLineRãt
stampItemst_undobuffersizeR·RùRh(RÊtcanvasRcR—R›R ((s./lib-tk/turtle.pyRw	s@		
						cCs<tj|ƒtj|ƒ|jƒ|jƒ|jƒdS(såDelete the turtle's drawings and restore its default values.

        No argument.
,
        Delete the turtle's drawings from the screen, re-center the turtle
        and set variables to the default values.

        Example (for a Turtle instance named turtle):
        >>> turtle.position()
        (0.00,-22.00)
        >>> turtle.heading()
        100.0
        >>> turtle.reset()
        >>> turtle.position()
        (0.00,0.00)
        >>> turtle.heading()
        0.0
        N(RôRXRRt_clearRíRh(RÊ((s./lib-tk/turtle.pyRXŸ	s




cCs7|dks|dkr$d|_nt|ƒ|_dS(s¢Set or disable undobuffer.

        Argument:
        size -- an integer or None

        If size is an integer an empty undobuffer of given size is installed.
        Size gives the maximum number of turtle-actions that can be undone
        by the undo() function.
        If size is None, no undobuffer is present.

        Example (for a Turtle instance named turtle):
        >>> turtle.setundobuffer(42)
        iN(R¨RùR·(RÊtsize((s./lib-tk/turtle.pyR`¸	scCs |jdkrdS|jjƒS(s¾Return count of entries in the undobuffer.

        No argument.

        Example (for a Turtle instance named turtle):
        >>> while undobufferentries():
        ...     undo()
        iN(RùR¨R¿(RÊ((s./lib-tk/turtle.pyRnË	s	cCs›d|_|_x!|jD]}|jj|ƒqW|jjƒ|_g|_|j	rn|jj
|jƒn|jg|_|jƒ|j
|jƒdS(sDelete all of pen's drawingsN(R¨RBRCRãR RgRbRERFRRVRúR0R`RH(RÊRf((s./lib-tk/turtle.pyRJØ	s		
cCs|jƒ|jƒdS(sgDelete the turtle's drawings from the screen. Do not move turtle.

        No arguments.

        Delete the turtle's drawings from the screen. Do not move turtle.
        State and position of the turtle as well as drawings of other
        turtles are not affected.

        Examples (for a Turtle instance named turtle):
        >>> turtle.clear()
        N(RJRh(RÊ((s./lib-tk/turtle.pyR.æ	s
cCsd|jjƒ|jjdkr#dSt|jƒdkr`|jj|j|j|j|jƒndS(Nii(	R RëRÐRšRFRdRERR(RÊ((s./lib-tk/turtle.pyRìõ	s
cCs§|j}|jdkrdS|jdkr\|jƒ|jƒ|jƒ|j|jƒnG|jƒ|jdkr£x|jƒD]}|jƒq‚W|jƒndS(s&Perform a Turtle-data update.
        iNi(	R RÏRìRíRhRjRÉRÐR$(RÊR RŽ((s./lib-tk/turtle.pyRhý	s	



cCs|jj||ƒS(smTurns turtle animation on/off and set delay for update drawings.

        Optional arguments:
        n -- nonnegative  integer
        delay -- nonnegative  integer

        If n is given, only each n-th regular screen update is really performed.
        (Can be used to accelerate the drawing of complex graphics.)
        Second arguments sets delay value (see RawTurtle.delay())

        Example (for a Turtle instance named turtle):
        >>> turtle.tracer(8, 25)
        >>> dist = 2
        >>> for i in range(200):
        ...     turtle.fd(dist)
        ...     turtle.rt(90)
        ...     dist += 2
        (R R#(RÊtflagR((s./lib-tk/turtle.pyR#
scCs|jj|ƒS(N(R Ræ(RÊR/((s./lib-tk/turtle.pyRæ$
scCs|jj|ƒS(N(R Rä(RÊR/((s./lib-tk/turtle.pyRä'
scCst|tƒr|Sy|\}}}Wntdt|ƒƒ‚nX|jjdkrg|||fD]}td|ƒ^qh\}}}nd|ko§dknoád|koÃdknoád|koßdknsýtdt|ƒƒ‚nd|||fS(s,Convert colortriples to hexstrings.
        sbad color arguments: %sgð?gào@iiÿsbad color sequence: %ss
#%02x%02x%02x(RÍR¯R¬RÁR RÊRá(RÊR/R£RâRãRÈ((s./lib-tk/turtle.pyt_cc*
s8TcCsI|j}|j|jƒ|j}d|_d|_t|ƒ}||_||_||_t||jjƒ|_|jj	|ƒ|j
|jjj}|dkrº|jƒ|j_
nr|dkrè|j|j
djƒ|j_
nD|dkr,g|j
|jjjD]}|jƒ^q|j_
n|jƒ|_|jƒ|S(sCreate and return a clone of the turtle.

        No argument.

        Create and return a clone of the turtle with same position, heading
        and turtle properties.

        Example (for a Turtle instance named mick):
        mick = Turtle()
        joe = mick.clone()
        R­RRIR®N(R R0RRžR¨RR9R;RÑRVRÆR˜RUR<R’R²RbRERh(RÊR RžtqtttypeRf((s./lib-tk/turtle.pyR19
s,							"5
cCs\|dkr|jjS||jjƒkr>td|ƒ‚n|jj|ƒ|jƒdS(sßSet turtle shape to shape with given name / return current shapename.

        Optional argument:
        name -- a string, which is a valid shapename

        Set turtle shape to shape with given name or, if name is not given,
        return name of current shape.
        Shape with name must exist in the TurtleScreen's shape dictionary.
        Initially there are the following polygon shapes:
        'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'.
        To learn about how to deal with shapes see Screen-method register_shape.

        Example (for a Turtle instance named turtle):
        >>> turtle.shape()
        'arrow'
        >>> turtle.shape("turtle")
        >>> turtle.shape()
        'turtle'
        sThere is no shape named %sN(R¨RžR;R RR¬R:Rh(RÊRà((s./lib-tk/turtle.pyRca
s
cCsß||ko"|ko"dknrF|j\}}|||jfS|dk	r||dkrm||f}q§||f}n+|dk	rž|jd|f}n	|j}|dkr¿|j}n|jddd|d|ƒdS(sOSet/return turtle's stretchfactors/outline. Set resizemode to "user".

        Optional arguments:
           stretch_wid : positive number
           stretch_len : positive number
           outline  : positive number

        Return or set the pen's attributes x/y-stretchfactors and/or outline.
        Set resizemode to "user".
        If and only if resizemode is set to "user", the turtle will be displayed
        stretched according to its stretchfactors:
        stretch_wid is stretchfactor perpendicular to orientation
        stretch_len is stretchfactor in direction of turtles orientation.
        outline determines the width of the shapes's outline.

        Examples (for a Turtle instance named turtle):
        >>> turtle.resizemode("user")
        >>> turtle.shapesize(5, 5, 12)
        >>> turtle.shapesize(outline=8)
        iRYR#R.RSN(R¨RR!RN(RÊtstretch_widtstretch_lenRSR.((s./lib-tk/turtle.pyRd|
s'	cCsK||j|j}|tjddtj}|jddd|ƒdS(sZRotate the turtleshape to point in the specified direction

        Optional argument:
        angle -- number

        Rotate the turtleshape to point in the direction specified by angle,
        regardless of its current tilt-angle. DO NOT change the turtle's
        heading (direction of movement).


        Examples (for a Turtle instance named turtle):
        >>> turtle.shape("circle")
        >>> turtle.shapesize(5,2)
        >>> turtle.settiltangle(45)
        >>> stamp()
        >>> turtle.fd(50)
        >>> turtle.settiltangle(-45)
        >>> stamp()
        >>> turtle.fd(50)
        g€f@iRYR#RiN(RþRøRÓR‰RN(RÊRÔRi((s./lib-tk/turtle.pyR_¢
scCs.|jdtj|j}||j|jS(s£Return the current tilt-angle.

        No argument.

        Return the current tilt-angle, i. e. the angle between the
        orientation of the turtleshape and the heading of the turtle
        (its direction of movement).

        Examples (for a Turtle instance named turtle):
        >>> turtle.shape("circle")
        >>> turtle.shapesize(5,2)
        >>> turtle.tilt(45)
        >>> turtle.tiltangle()
        g€f@(R RÓR‰RøRþRý(RÊRi((s./lib-tk/turtle.pyRj»
scCs|j||jƒƒdS(sÌRotate the turtleshape by angle.

        Argument:
        angle - a number

        Rotate the turtleshape by angle from its current tilt-angle,
        but do NOT change the turtle's heading (direction of movement).

        Examples (for a Turtle instance named turtle):
        >>> turtle.shape("circle")
        >>> turtle.shapesize(5,2)
        >>> turtle.tilt(30)
        >>> turtle.fd(50)
        >>> turtle.tilt(30)
        >>> turtle.fd(50)
        N(R_Rj(RÊRÔ((s./lib-tk/turtle.pyRiÍ
sc
Cs°|j}|j\}}|j\}}t|||j|jƒ}dt|ƒ|\}}g|D]G\}}	|||||	|j|||||	|jf^qeS(slComputes transformed polygon shapes from a shape
        according to current position and heading.
        gð?(R RúRüR
RPROR(
RÊRµR tp0tp1te0te1R~RÈRÉ((s./lib-tk/turtle.pyt
_polytrafoà
s	cCs}|j}|j|jj}|j}|jj}|jrÇ|jdkrÇ|jdkrÇt	|_
|j}|dkrÙ|jdkr”d}|}nø|jdkrÏt
d|jdƒ}}|j}d}	n3|jdkr|j\}}|j}|j}	ng|D] \}
}||
||f^q	}tj|	ƒtj|	ƒ}}
g|D]1\}
}|
|
||||
|
|f^qU}|j|ƒ}|j|j}}|j||d|d	|d
|dtƒqy|dkrþ|j||j|ƒqy|d
kry|j\}}|j}xŸt||ƒD]‹\}\}}}g|D] \}
}||
||f^qN}|j|ƒ}|j||d|j|ƒd	|j|ƒd
|dtƒq2Wqyn²|j
rÔdS|dkr|j|dddfddƒnn|dkr1|j||j|jdjƒn?|d
krpx0|D]%}|j|dddfddƒqDWnt|_
dS(spManages the correct rendering of the turtle with respect to
        its shape, resizemode, stretch and tilt etc.iR­RšiR"g@R#R:RSRpR\RR®NR»RI(ii(ii(ii(ii(ii(ii(R RÆRžR;R˜R<RRÐRÏR§RDR²RtmaxRRR!R RÓR‹R|RVRRR^R¦R•RútzipRM(RÊR RcROttitemttshapeRQtlxtlyRjRÈRÉtt0tt1tfctocRfRµ((s./lib-tk/turtle.pyRíì
s^		'						->	%-&	"
&cCs	|j}|j|jj}|j}|j}|dkr©|jƒ}|jdkrdd}|}nø|jdkrŸtd|j	dƒ}}|j	}d}	n3|jdkrÒ|j
\}}|j}|j}	ng|D] \}
}||
||f^qÙ}t
j|	ƒt
j|	ƒ}}
g|D]1\}
}|
|
||||
|
|f^q%}|j|ƒ}|j|j}}|j||d|d	|d
|dtƒn6|dkrÝ|jd
ƒ}|j||j|ƒn|dkrßg}x'|D]}|jƒ}|j|ƒqöWt|ƒ}|j
\}}|j}xŸt||ƒD]‹\}\}}}g|D] \}
}||
||f^qi}|j|ƒ}|j||d|j|ƒd	|j|ƒd
|dtƒqMWn|jj|ƒ|jjd|fƒ|S(sÅStamp a copy of the turtleshape onto the canvas and return its id.

        No argument.

        Stamp a copy of the turtle shape onto the canvas at the current
        turtle position. Return a stamp_id for that stamp, which can be
        used to delete it by calling clearstamp(stamp_id).

        Example (for a Turtle instance named turtle):
        >>> turtle.color("blue")
        >>> turtle.stamp()
        13
        >>> turtle.fd(50)
        R­RšiR"g@iR#R:RSRpR\RR»R®Rh(R RÆRžR;R˜R²RURRWRRR!R RÓR‹R|RVRRR^R¦R’R•RúRVRÅRXRMRGRùR¼(RÊR RcRORZtstitemRQR[R\RjRÈRÉR]R^R_R`telementRfRµ((s./lib-tk/turtle.pyRh#sV							->
	%-#cCs||jkret|tƒrBx1|D]}|jj|ƒq%Wn|jj|ƒ|jj|ƒnd|f}|j}||jkrdS|jj|ƒ}|jj|ƒ||j	krØ|j	d|j
|_	n|jj|j	d|j
dgƒdS(s9does the work for clearstamp() and clearstamps()
        RhNi(
RGRÍRÅR RgRðRùR¹tindexRºR¸tinsertR¨(RÊtstampidtsubitemRftbufRc((s./lib-tk/turtle.pyt_clearstamp_s
	cCs|j|ƒ|jƒdS(sDDelete stamp with given stampid

        Argument:
        stampid - an integer, must be return value of previous stamp() call.

        Example (for a Turtle instance named turtle):
        >>> turtle.color("blue")
        >>> astamp = turtle.stamp()
        >>> turtle.fd(50)
        >>> turtle.clearstamp(astamp)
        N(RhRh(RÊRe((s./lib-tk/turtle.pyR/us
cCsn|dkr|j}n)|dkr5|j| }n
|j|}x|D]}|j|ƒqIW|jƒdS(sìDelete all or first/last n of turtle's stamps.

        Optional argument:
        n -- an integer

        If n is None, delete all of pen's stamps,
        else if n > 0 delete first n stamps
        else if n < 0 delete last n stamps.

        Example (for a Turtle instance named turtle):
        >>> for i in range(8):
        ...     turtle.stamp(); turtle.fd(30)
        ...
        >>> turtle.clearstamps(2)
        >>> turtle.clearstamps(-2)
        >>> turtle.clearstamps()
        iN(R¨RGRhRh(RÊRéttoDeleteRf((s./lib-tk/turtle.pyR0„s


cCsf|j|j|jt|jtƒf}|j}d|j|||j|j	|j
|jƒ|jff}|jr‡|jj
|ƒn|j}|jrÐ|jdkrÐ||}|d|jd|d|jd}dt|ddd|j|jƒ}|d|}	x„td|ƒD]s}
|
dkr=t}nt}||	|
|_|jr‹|j|j||jf|j|j|ƒn|jƒq"W|jrÐ|j|jddfd	d
d|jƒqÐn|jrì|j	j|ƒnt|jtƒr|jj|ƒn||_|jr6|jj|ƒnt|j	ƒdkrX|jƒn|jƒd
S(s˜Move the pen to the point end, thereby drawing a line
        if pen is down. All other methods for turtle movement depend
        on this one.
        tgoiiigà?igš™™™™™ñ?gð?R:R»Rpi*N(ii(ii(RRRRÍRCRÞR RúRERFRRãRùR¼RRÏRORPR±R™R¦R§RdR?RhRVRAR@RšR0(RÊRtgo_modesR t
undo_entrytstarttdifftdiffsqtnhopstdeltaRéR\((s./lib-tk/turtle.pyR sR			
(*						
cCs|\}}}}|\}}}}	|\}
}}}
|j}t|j|ƒdkr`dGHn|
|_||_|ddgkrd}n|}|j|
|d|d|ƒg|jD]-}||
kr¹|j|ƒdkr¹|^q¹}x+|D]#}|j|ƒ|jj	|ƒqóW|}|j
rQ|jdkrQ||}|d|jd	|d|j
d	}dt|dd
d|j
|j
ƒ}|d|}x{td|ƒD]j}|dkrÍt}nt}||||_|r|j|j||jf|||ƒn|jƒq²W|rQ|j|jddfddd|ƒqQn||_|jr¯t|jƒdkrˆ|jjƒn|jgkr¯t|_d|_q¯n|	r÷|jgkrÕd|_d
GHq÷|jdk	r÷|jjƒq÷n|jƒdS(s)Reverse a _goto. Used for undo()
        gà?s$undogoto: HALLO-DA-STIMMT-WAS-NICHT!iR»R:RpR¶iiigš™™™™™ñ?gð?sUnwahrscheinlich in _undogoto!N(ii(ii(ii(ii(R RRúRERFRdRãR˜RgRðRRÏRORPR±R™R¦R§R?RhRARšR@R½R¨RC(RÊtentrytoldtnewRktcoodatatdrawingtpctpstfillingtcLItcLRœRãR tusepcR›ttodeleteRmRnRoRpRqRéR\((s./lib-tk/turtle.pyt	_undogotoÕsd				!


(*					cCsó|jr(|jjd||jfƒn||j9}|jj|ƒ}|jj}|dkrÜ|jdkrÜd|j}dtt	|ƒ|ƒ}d||}x6t
|ƒD]%}|jj|ƒ|_|jƒq°Wn||_|jƒdS(s&Turns pen clockwise by angle.
        trotiig@gð?N(RùR¼RþRüRØR RÏRR±RR™Rh(RÊRÔt	neworientRîtanglevelRRqRì((s./lib-tk/turtle.pyRs	

	cCs t|jƒdkrb|jj|j|j|j|jƒ|jjƒ|_|jj	|jƒn|jj|jdt
ƒg|_|rœ|jg|_ndS(s¶Closes current line item and starts a new one.
           Remark: if current line became too long, animation
           performance (via _drawline) slowed down considerably.
        iR\N(RšRFR RdRERRRbRãRVR¦Rú(RÊR7((s./lib-tk/turtle.pyR0(s	cCsmt|jtƒ}|dkr"|S|j}d}}|r‡t|jƒdkr‡|jj|j|jd|jƒd|jf}q‡n|rÝ|jj	ƒ|_|j
j|jƒ|jg|_d|jf}|j
ƒnd|_|_|jr_|dkr$|d	kr\|jj|ƒq\q_|d
krC|jj|ƒq_|jjd||gƒn|jƒdS(s§Call fill(True) before drawing a shape to fill, fill(False) when done.

        Optional argument:
        flag -- True/False (or 1/0 respectively)

        Call fill(True) before drawing the shape you want to fill,
        and  fill(False) when done.
        When used without argument: return fillstate (True if filling,
        False else)

        Example (for a Turtle instance named turtle):
        >>> turtle.fill(True)
        >>> turtle.forward(100)
        >>> turtle.left(90)
        >>> turtle.forward(100)
        >>> turtle.left(90)
        >>> turtle.forward(100)
        >>> turtle.left(90)
        >>> turtle.forward(100)
        >>> turtle.fill(False)
        iR:tdofillt	beginfillR
N(((((RÍRCRÞR¨R RšR^RBRRURãRVRúR0RùR¼Rh(RÊRLRyR tentry1tentry2((s./lib-tk/turtle.pyR:8s2	


	cCs|jtƒdS(s˜Called just before drawing a shape to be filled.

        No argument.

        Example (for a Turtle instance named turtle):
        >>> turtle.begin_fill()
        >>> turtle.forward(100)
        >>> turtle.left(90)
        >>> turtle.forward(100)
        >>> turtle.left(90)
        >>> turtle.forward(100)
        >>> turtle.left(90)
        >>> turtle.forward(100)
        >>> turtle.end_fill()
        N(R:R¦(RÊ((s./lib-tk/turtle.pyR*kscCs|jtƒdS(s™Fill the shape drawn after the call begin_fill().

        No argument.

        Example (for a Turtle instance named turtle):
        >>> turtle.begin_fill()
        >>> turtle.forward(100)
        >>> turtle.left(90)
        >>> turtle.forward(100)
        >>> turtle.left(90)
        >>> turtle.forward(100)
        >>> turtle.left(90)
        >>> turtle.forward(100)
        >>> turtle.end_fill()
        N(R:R§(RÊ((s./lib-tk/turtle.pyR7}scGsÅ|stt|ttfƒrF|j|ƒ}|jt|jdƒ}q«|j}|s«|jt|jdƒ}q«n7|dkrœ|jt|jdƒ}n|j|ƒ}t|j	dƒr
|j	j
|j||ƒ}|jj
|ƒ|jrÁ|jjd|fƒqÁn´|jƒ}|jrD|jjdgƒt|j_nzT|jƒdkrf|jƒn|jƒ|j|ƒ|j|ƒ|jdƒWd|j|ƒX|jrÁt|j_ndS(sÑDraw a dot with diameter size, using color.

        Optional arguments:
        size -- an integer >= 1 (if given)
        color -- a colorstring or a numeric color tuple

        Draw a circular dot with diameter size, using color.
        If size is not given, the maximum of pensize+4 and 2*pensize is used.

        Example (for a Turtle instance named turtle):
        >>> turtle.dot()
        >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50)
        it_dotR5R
R"iN(RÍR¯RÅRäRRWRR¨thasattrR R†RúRãRVRùR¼RNR¦R»RYRERPRQROR<R§(RÊRKR2RfRN((s./lib-tk/turtle.pyR5s:			



	cCs`|jj|j||||jƒ\}}|jj|ƒ|jr\|jjd|fƒn|S(s)Performs the writing for write()
        twri(R R~RúRRãRVRùR¼(RÊRxRyRvRfR((s./lib-tk/turtle.pyR~Âs	RHtArialiR'cCs“|jr+|jjdgƒt|j_n|jt|ƒ|jƒ|ƒ}|rw|jƒ\}}|j||ƒn|jrt	|j_ndS(s÷Write text at the current turtle position.

        Arguments:
        arg -- info, which is to be written to the TurtleScreen
        move (optional) -- True/False
        align (optional) -- one of the strings "left", "center" or right"
        font (optional) -- a triple (fontname, fontsize, fonttype)

        Write text - the string representation of arg - at the current
        turtle position according to align ("left", "center" or right")
        and with the given font.
        If move is True, the pen is moved to the bottom-right corner
        of the text. By default, move is False.

        Example (for a Turtle instance named turtle):
        >>> turtle.write('Home = ', True, align="center")
        >>> turtle.write((0,0), True)
        R
N(
RùR¼R¦R»R~RÁR°RSR]R§(RÊtargtmoveRyRvRRÈRÉ((s./lib-tk/turtle.pyRqÌs	!	cCs|jg|_t|_dS(sStart recording the vertices of a polygon.

        No argument.

        Start recording the vertices of a polygon. Current turtle position
        is first point of polygon.

        Example (for a Turtle instance named turtle):
        >>> turtle.begin_poly()
        N(RúR@R¦RA(RÊ((s./lib-tk/turtle.pyR+éscCs
t|_dS(s7Stop recording the vertices of a polygon.

        No argument.

        Stop recording the vertices of a polygon. Current turtle position is
        last point of polygon. This will be connected with the first point.

        Example (for a Turtle instance named turtle):
        >>> turtle.end_poly()
        N(R§RA(RÊ((s./lib-tk/turtle.pyR8÷scCs |jdk	rt|jƒSdS(sÔReturn the lastly recorded polygon.

        No argument.

        Example (for a Turtle instance named turtle):
        >>> p = turtle.get_poly()
        >>> turtle.register_shape("myFavouriteShape", p)
        N(R@R¨RÅ(RÊ((s./lib-tk/turtle.pyR=
s
cCs|jS(s˜Return the TurtleScreen object, the turtle is drawing  on.

        No argument.

        Return the TurtleScreen object, the turtle is drawing  on.
        So TurtleScreen-methods can be called for that object.

        Example (for a Turtle instance named turtle):
        >>> ts = turtle.getscreen()
        >>> ts
        <turtle.TurtleScreen object at 0x0106B770>
        >>> ts.bgcolor("pink")
        (R (RÊ((s./lib-tk/turtle.pyR?
scCs|S(sUReturn the Turtleobject itself.

        No argument.

        Only reasonable use: as a function to return the 'anonymous turtle':

        Example:
        >>> pet = getturtle()
        >>> pet.fd(50)
        >>> pet
        <turtle.Turtle object at 0x0187D810>
        >>> turtles()
        [<turtle.Turtle object at 0x0187D810>]
        ((RÊ((s./lib-tk/turtle.pyR@!
scCs|jjƒdS(s² Returns the width of the turtle window.

        No argument.

        Example (for a TurtleScreen instance named screen):
        >>> screen.window_width()
        640
        i(R Rª(RÊ((s./lib-tk/turtle.pyR'9
s	cCs|jjƒdS(s³ Return the height of the turtle window.

        No argument.

        Example (for a TurtleScreen instance named screen):
        >>> screen.window_height()
        480
        i(R Rª(RÊ((s./lib-tk/turtle.pyR&D
s	cCs|jj|ƒS(sDSet delay value which determines speed of turtle animation.
        (R R(RÊR((s./lib-tk/turtle.pyRjO
sicCs-|jj|jj|||ƒ|jƒdS(s¹Bind fun to mouse-click event on this turtle on canvas.

        Arguments:
        fun --  a function with two arguments, to which will be assigned
                the coordinates of the clicked point on the canvas.
        num --  number of the mouse-button defaults to 1 (left mouse button).
        add --  True or False. If True, new binding will be added, otherwise
                it will replace a former binding.

        Example for the anonymous turtle, i. e. the procedural way:

        >>> def turn(x, y):
        ...     left(360)
        ...
        >>> onclick(turn)  # Now clicking into the turtle will turn it.
        >>> onclick(None)  # event-binding will be removed
        N(R R‡RžR<Rh(RÊRRÓR†((s./lib-tk/turtle.pyRJV
scCs-|jj|jj|||ƒ|jƒdS(sÿBind fun to mouse-button-release event on this turtle on canvas.

        Arguments:
        fun -- a function with two arguments, to which will be assigned
                the coordinates of the clicked point on the canvas.
        num --  number of the mouse-button defaults to 1 (left mouse button).

        Example (for a MyTurtle instance named joe):
        >>> class MyTurtle(Turtle):
        ...     def glow(self,x,y):
        ...             self.fillcolor("red")
        ...     def unglow(self,x,y):
        ...             self.fillcolor("")
        ...
        >>> joe = MyTurtle()
        >>> joe.onclick(joe.glow)
        >>> joe.onrelease(joe.unglow)

        Clicking on joe turns fillcolor red, unclicking turns it to
        transparent.
        N(R RˆRžR<Rh(RÊRRÓR†((s./lib-tk/turtle.pyRLk
scCs#|jj|jj|||ƒdS(s’Bind fun to mouse-move event on this turtle on canvas.

        Arguments:
        fun -- a function with two arguments, to which will be assigned
               the coordinates of the clicked point on the canvas.
        num -- number of the mouse-button defaults to 1 (left mouse button).

        Every sequence of mouse-move-events on a turtle is preceded by a
        mouse-click event on that turtle.

        Example (for a Turtle instance named turtle):
        >>> turtle.ondrag(turtle.goto)

        Subsequently clicking and dragging a Turtle will move it
        across the screen thereby producing handdrawings (if pen is
        down).
        N(R R‰RžR<(RÊRRÓR†((s./lib-tk/turtle.pyRK„
scCs|jdkrdS|dkrV|\}}|j|||jƒ|jjƒ}n5|dkr||d}|j|ƒn|dkr˜|j|ƒnó|dkrÑ|d}|jj|ƒ|j	j
|ƒnº|dkr|d}|jj|dddfd	d
dd
ƒny|dkr[|d}d|_|_
|jj|ƒ|j	j
|ƒn0|d
kr‹tj||dƒ|jjƒndS(s2Does the main part of the work for undo()
        NRRhiRjRˆR5R‚R:R»RSRƒRN(swrisdot(ii(ii(ii(RùR¨RRþR½R/R~R RgRãRðR^RBRCRRN(RÊtactionR´RÔtdegPAUtdummyRaRf((s./lib-tk/turtle.pyt_undo™
s6



cCsŠ|jdkrdS|jjƒ}|d}|d}|dkrvxA|rr|jƒ}|j|d|dƒqEWn|j||ƒdS(s±undo (repeatedly) the last turtle action.

        No argument.

        undo (repeatedly) the last turtle action.
        Number of available undo actions is determined by the size of
        the undobuffer.

        Example (for a Turtle instance named turtle):
        >>> for i in range(4):
        ...     turtle.fd(50); turtle.lt(80)
        ...
        >>> for i in range(8):
        ...     turtle.undo()
        ...
        NiiR
(RùR¨R½R(RÊRfRŒR´((s./lib-tk/turtle.pyRm¸
s

	N(R‰isnormal(9RÛRÜRÝR>R¨R½RRXR`RnRJR.RìRhR#RæRäRMR1RcRdR_RjRiRVRíRhRhR/R0RR~RR¦R0R:R*R7R5R~R§RqR+R8R=R?R@R>R'R&RjRJRLRKRRmRl(((s./lib-tk/turtle.pyRp	sl%			
								(&					7	<			5	A	3		3	
		
	
						cCs%tjdkrtƒt_ntjS(s‡Return the singleton screen object.
    If none exists at the moment, create a new one and return it,
    else return the existing one.N(R	t_screenR¨R=(((s./lib-tk/turtle.pyRÛ
sR=cBspeZdZdZedZd„Zededededd„Zd„Z	d„Z
d	„Zd
„ZRS(R"cCsñtjdkrKtƒt_|_|jjtjƒ|jj|jƒntjdkrít	d}t	d}t	d}t	d}t	d}t	d}|jj
||||ƒ|jjƒt_tj
|tjƒ|j||||ƒndS(NRpR‘R’R“R”R•(R=t_rootR¨R4R"t_titleRBt_destroyRR½R9R:RRR (RÊRpR‘R’R“R”R•((s./lib-tk/turtle.pyRé
s





RpR‘R”R•cCst|jdƒsdS|jjƒ}|jjƒ}t|tƒrld|koZdknrl||}n|dkr‰||d}nt|tƒrÁd|ko¯dknrÁ||}n|dkrÞ||d}n|jj||||ƒ|jƒdS(s Set the size and position of the main window.

        Arguments:
        width: as integer a size in pixels, as float a fraction of the screen.
          Default is 50% of screen.
        height: as integer the height in pixels, as float a fraction of the
          screen. Default is 75% of screen.
        startx: if positive, starting position in pixels from the left
          edge of the screen, if negative from the right edge
          Default, startx=None is to center window horizontally.
        starty: if positive, starting position in pixels from the top
          edge of the screen, if negative from the bottom edge
          Default, starty=None is to center window vertically.

        Examples (for a Screen instance named screen):
        >>> screen.setup (width=200, height=200, startx=0, starty=0)

        sets window to 200x200 pixels, in upper left of screen

        >>> screen.setup(width=.75, height=0.5, startx=None, starty=None)

        sets window to 75% of screen by 50% of screen and centers
        R>Niii(	R‡R‘RDRFRÍR°R¨R>R%(RÊRpR‘R<R=Rqtsh((s./lib-tk/turtle.pyR ÿ
s+
+
cCs/tjdk	r"tjj|ƒn|t_dS(sqSet title of turtle-window

        Argument:
        titlestring -- a string, to appear in the titlebar of the
                       turtle graphics window.

        This is a method of Screen-class. Not available for TurtleScreen-
        objects.

        Example (for a Screen instance named screen):
        >>> screen.title("Welcome to the turtle-zoo!")
        N(R=R‘R¨R"R’(RÊttitlestring((s./lib-tk/turtle.pyR"'s
cCsV|j}|tjkr?dt_dt_dt_dt_ntt_	|j
ƒdS(N(R‘R=R¨R	RÒRRR§RRêRA(RÊtroot((s./lib-tk/turtle.pyR“8s					cCs|jƒdS(s~Shut the turtlegraphics window.

        Example (for a TurtleScreen instance named screen):
        >>> screen.bye()
        N(R“(RÊ((s./lib-tk/turtle.pyRBscsW‡fd†}ˆj|ƒtdr*dSytƒWntk
rRtdƒnXdS(slGo into mainloop until the mouse is clicked.

        No arguments.

        Bind bye() method to mouseclick on TurtleScreen.
        If "using_IDLE" - value in configuration dictionary is False
        (default value), enter mainloop.
        If IDLE with -n switch (no subprocess) is used, this value should be
        set to True in turtle.cfg. In this case IDLE's mainloop
        is active also for the client script.

        This is a method of the Screen-class and not available for
        TurtleScreen instances.

        Example (for a Screen instance named screen):
        >>> screen.exitonclick()

        csˆjƒdS(s&Screen.bye() with two dummy-parametersN(R(RÈRÉ(RÊ(s./lib-tk/turtle.pytexitGracefully]sR¢Ni(RJR½RvtAttributeErrortexit(RÊR—((RÊs./lib-tk/turtle.pyRJs


N(
RÛRÜR¨R‘RR½R’RR R"R“RR(((s./lib-tk/turtle.pyR=ã
s
	'		
	cBs8eZdZdZdZedededd„ZRS(sÀRawTurtle auto-creating (scrolled) canvas.

    When a Turtle object is created or a function derived from some
    Turtle method is called a TurtleScreen object is automatically created.
    RcR—R›c	CsGtjdkrtƒt_ntj|tjd|d|d|ƒdS(NRcR—R›(R	RR¨RRR(RÊRcR—R›((s./lib-tk/turtle.pyRqsN(RÛRÜRÝR¨RÒRR½R(((s./lib-tk/turtle.pyR	hstturtle_docstringdictcCsRi}x+tD]#}d|}t|ƒj||<q
Wx+tD]#}d|}t|ƒj||<q;Wtd|dƒ}tg|jƒD]%}|jdƒdtkr…|^q…ƒ}|j	dƒx>|d D]2}|j	d	t
|ƒƒ|j	d
||ƒqËW|d}|j	d	t
|ƒƒ|j	d||ƒ|j	dƒ|jƒd
S(s±Create and write docstring-dictionary to file.

    Optional argument:
    filename -- a string, used as filename
                default value is turtle_docstringdict

    Has to be called explicitly, (not used by the turtle-graphics classes)
    The docstring dictionary will be written to the Python script <filname>.py
    It is intended to serve as a template for translation of the docstrings
    into different languages.
    s_Screen.sTurtle.s%s.pyRQR©isdocsdict = {

iÿÿÿÿs%s :
s        """%s
""",

s        """%s
"""

s}
N(t_tg_screen_functionsR¯RÝt_tg_turtle_functionsRªRïRêRt_alias_listRqtreprR¬(R²tdocsdictt
methodnameR·R³RÈRê((s./lib-tk/turtle.pyRt~s&



(


cCsndi|jƒd6}t|ƒ}|j}x;|D]3}y||t|ƒj_Wq3d|GHq3Xq3WdS(sñRead in docstrings from lang-specific docstring dictionary.

    Transfer docstrings, translated to lang, from a dictionary-file
    to the methods of classes Screen and Turtle and - in revised form -
    to the corresponding functions.
    s!turtle_docstringdict_%(language)sRsBad docstring-entry: %sN(R°t
__import__RŸR¯tim_funcRÝ(tlangtmodnametmoduleRŸR·((s./lib-tk/turtle.pytread_docstrings s	
sCannot find docsdict fors;Unknown Error when trying to import %s-docstring-dictionaryc
CsÙd}}t|ƒtjkr1|j}d}n|}d}t|ƒtjtjgkrÏyg|jj}t|jj	||!ƒ}|jj	||!}|j
p¢g}ttd„|ƒƒ}dgt|ƒt|ƒ|}td„||ƒ}	|jj
d@rF|	jd|jj	|ƒ|jd|jj	|ƒ|d7}n|jj
d@r|	jd	|jj	|ƒ|jd	|jj	|ƒnd
j|	ƒ}d|}d
j|ƒ}d|}WqÏqÏXn||fS(s9Get strings describing the arguments for the given objectR»iicSsdt|ƒS(Ns=%s(Rž(Rà((s./lib-tk/turtle.pyt<lambda>ÏscSs||S(N((RŠtdflt((s./lib-tk/turtle.pyR§ÑsiRis**s, s(%s)(RäRåt
MethodTypeR¢Ræt
LambdaTypet	func_codetco_argcountRÞtco_varnamest
func_defaultstmapRštco_flagsRVR(
tobtargText1targText2tfobt	argOffsettcountertitems2trealArgstdefaultstitems1((s./lib-tk/turtle.pytgetmethparlist½s:
		!

cCseddl}|dkrdStd}|jd|dƒ}|jd|ƒ}|jd|ƒ}|S(s<To reduce docstrings from RawTurtle class for functions
    iÿÿÿÿNRŸs%s.R»s \(.+ %s\):t:(treR¨R½treplacetcompiletsub(tdocstrR½t
turtlenamet	newdocstrtparexp((s./lib-tk/turtle.pyt_turtle_docreviseás
cCseddl}|dkrdStd}|jd|dƒ}|jd|ƒ}|jd|ƒ}|S(s?To reduce docstrings from TurtleScreen class for functions
    iÿÿÿÿNR¡s%s.R»s \(.+ %s\):R¼(R½R¨R½R¾R¿RÀ(RÁR½t
screennameRÃRÄ((s./lib-tk/turtle.pyt_screen_docreviseís
srdef {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
c
Bs£xœ|D]”}e||ƒ}e|ƒ\}}|dkrMdG|G|GHqnejd|d|d|d|d|ƒ}	|	eƒU||jƒeƒ|_qWdS(NR»s>>>>>>tobjtinitRàt
paramslisttargslist(tgetattrR»t__func_bodytformattglobalsRÝ(
t	functionsRÇRÈRÉt	docreviseR Rítpl1tpl2tdefstr((s./lib-tk/turtle.pyt_make_global_funcs
s

sTurtle._screensScreen()sTurtle._pensTurtle()t__main__cCstƒrtƒntƒdS(N(RFRURM(((s./lib-tk/turtle.pyt	switchpen"s	
cCsëtƒttƒtƒtdƒtƒtdƒx“tdƒD]…}|dkr_tdƒnx(tdƒD]}t	dƒt
dƒqlW|dkr­tdƒtd	ƒntƒt	d
ƒtƒq@Wtdƒtdƒttƒtƒt
dƒt	dƒt
dƒt	dƒt
dƒtƒtd
dƒtddƒtdƒx<tdƒD].}t	dƒt
dƒt	dƒt
dƒqXWttƒtdƒx<tdƒD].}t	dƒt
dƒt	dƒt
dƒq«Wtd	ƒdS(sDemo of old turtle.py - moduleidiiiiiiZtmarooniiR™i´t
startstartustarttrediN(RXR#R¦RoR)R6RpR™R:R<RHR2R§RWRq(R›Rì((s./lib-tk/turtle.pytdemo1(sX


























cCsOtdƒtƒtdƒttddƒƒtddƒd}tdƒx(tdƒD]}tƒt	|dƒqXWt
dƒxtƒr–tƒqƒWt
ƒtdƒtd	ƒd}td
ƒtdƒtdƒxtdd
ƒD]Œ}|dkrtƒtd	d|dd|ƒnx(tdƒD]}t|ƒtdƒq+W|d7}tdƒttƒddƒqæWtƒtdƒtƒtdƒtdƒtƒtddƒtdƒtdƒx?tdƒD]1}t	ddƒtdƒtdƒtdƒq×Wtdƒtdƒtƒtdƒtƒtdƒtƒ}|jdƒtƒ}|jdƒ|jdƒ|j
ƒ|jdƒ|jdƒ|jƒ|jddƒ|jdƒ|j ƒ|jdƒ|jddƒ|jdƒ|jdƒtt|ƒƒd}xŽ|j|ƒdkr­|jd ƒ|jd!ƒ|j|j|ƒƒ|jdƒ|d"dkr |j!ƒ|j!ƒtƒn|d7}q W|j
d#d$d/d'd(ƒ|jd)ƒ|jd*ƒd+„}t"j#dƒx!tƒr|jƒ|jƒqúW|jdƒ|j
d,d$d0ƒ|j$|dƒd.S(1sDemo of some new features.iiig@iZii
swait a moment...iÿtgreeni´iþÿÿÿiiixiiFiRÚtyellowii2RžR"uautoii(itblueuorangeig@g333333ã?isCAUGHT! RvR‰tboldRyurightR™uredcSstƒtƒdS(N(RR(RñRò((s./lib-tk/turtle.pytbaba²ss  Click me!tCourierN(sArialiRß(RáiRß(%RfRgRQR\RkR4RZR™R×R-RqRnRmRXRIRROR*R;R9R7RURMR2R:RcR@RYR	RHRoRAR6RhttimetsleepRJ(RRìtlaengeR›ttriRžR¾Rà((s./lib-tk/turtle.pytdemo2]s°
























	
	


















	


(GRÝt_vertTkinterR
RåRÓRâtostos.pathRRRtcopyRt_tg_classesR›Rœt
_tg_utilitiest_math_functionst__all__RR¨R¦R§R½R¹RÄRÅR
RáRëRñRùRRRR5R4tobjectRGt	ExceptionRR¬RR·RRôRR9RR
RR=R	RRtR¦t	_LANGUAGEtImportErrorR»RÅRÇRÍRÕRvRuRÛR×RÛRæR(((s./lib-tk/turtle.pyt<module>esþ
	!


		%	4	
	c	ÿJ	/&ÿÿÿÿÿÂÿÿÿÿk	…"	


	$				
	

		5	b