Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/lib-tk/turtle.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^cO@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�gZeeeeeZdd+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��Z7d��Z8d�d��Z9d��Z:ed�Z;ye;d�krOe:e;�nWn)e<k
rld�Ge;GHnd�e;GHnXd��Z=d��Z>d��Z?x�eD]�Z@e=eAd�e@��\ZBZCeBd�kr�d�GeBGeCGHq�nd�ie@d�6eBd�6eCd�6ZDeDdUe?eAd�e@�j�eAe@�_q�Wx�eD]�Z@e=eAd�e@��\ZBZCeBd�krtd�GeBGeCGHq3nd�e@d�6eBd�6eCd�6ZDeDdUe>eAd�e@�j�eAe@�_q3WejEZFZE[B[C[DeGd�rd�ZHd�ZId�ZJeI�eJ�eK�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_docstringdicttdonetmainlooptacostasintatantatan2tceiltcostcoshtetexptfabstfloortfmodtfrexpthypottldexptlogtlog10tmodftpitpowtsintsinhtsqrtttanttanhg��heighti�t	canvwidthi,t
canvheightt	leftrightt	topbottomtstandardg�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�|�}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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyR�scCs%t|d|d|d|d�S(Nii(R
(tselftother((s#/sys/lib/python2.7/lib-tk/turtle.pyt__add__scCsLt|t�r/|d|d|d|dSt|d||d|�S(Nii(t
isinstanceR
(R�R�((s#/sys/lib/python2.7/lib-tk/turtle.pyt__mul__s cCs?t|t�st|t�r;t|d||d|�SdS(Nii(R�R�R�R
(R�R�((s#/sys/lib/python2.7/lib-tk/turtle.pyt__rmul__scCs%t|d|d|d|d�S(Nii(R
(R�R�((s#/sys/lib/python2.7/lib-tk/turtle.pyt__sub__scCst|d|d�S(Nii(R
(R�((s#/sys/lib/python2.7/lib-tk/turtle.pyt__neg__scCs|dd|dddS(Niiig�(R�((s#/sys/lib/python2.7/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�@(R
tmathR�R|R�(R�tangletperptcts((s#/sys/lib/python2.7/lib-tk/turtle.pytrotatescCs|d|dfS(Nii((R�((s#/sys/lib/python2.7/lib-tk/turtle.pyt__getnewargs__&scCsd|S(Ns(%.2f,%.2f)((R�((s#/sys/lib/python2.7/lib-tk/turtle.pyt__repr__(s(
t__name__t
__module__t__doc__R�R�R�R�R�R�R�R�R�R�(((s#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyR�4s

cCsi}t||�|j�S(s#helper function for Scrolled Canvas(R�tkeys(R�R�((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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�N(
R�R�R�Rtconfigtxview_movetoRptyview_movetoR�t
adjustScrolls(R�R�R�R�((s#/sys/lib/python2.7/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�iRRRRiRR	R
RN(Rtwinfo_widthtwinfo_heightR$R�R%R�RRRtgrid_forget(R�tcwidthtcheight((s#/sys/lib/python2.7/lib-tk/turtle.pyR&�s""$$
cCs|j�dS(sself-explanatoryN(R&(R�tevent((s#/sys/lib/python2.7/lib-tk/turtle.pyR �scGs|jj|�S(s@ 'forward' method, which canvas itself has inherited...
        (Rtbbox(R�targs((s#/sys/lib/python2.7/lib-tk/turtle.pyR-�scOs|jj||�S(s@ 'forward' method, which canvas itself has inherited...
        (Rtcget(R�R.tkwargs((s#/sys/lib/python2.7/lib-tk/turtle.pyR/�scOs|jj||�dS(s@ 'forward' method, which canvas itself has inherited...
        N(RR#(R�R.R0((s#/sys/lib/python2.7/lib-tk/turtle.pyR#�scOs|jj||�dS(s@ 'forward' method, which canvas itself has inherited...
        N(RR(R�R.R0((s#/sys/lib/python2.7/lib-tk/turtle.pyR�scOs|jj||�dS(s@ 'forward' method, which canvas itself has inherited...
        N(Rtunbind(R�R.R0((s#/sys/lib/python2.7/lib-tk/turtle.pyR1�scCs|jj�dS(s@ 'forward' method, which canvas itself has inherited...
        N(Rtfocus_force(R�((s#/sys/lib/python2.7/lib-tk/turtle.pyR2�sN(R�R�R�RR�RXR&R R-R/R#RR1R2(((s#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyR�scCs8t|||||�|_|jjdddd�dS(NtexpandiR:tboth(RRtpack(R�RpR�R*R+((s#/sys/lib/python2.7/lib-tk/turtle.pytsetupcanvas�scCs|jS(N(R(R�((s#/sys/lib/python2.7/lib-tk/turtle.pyt
_getcanvas�scCs!|jd||||f�dS(Ns%dx%d%+d%+d(tgeometry(R�RpR�tstartxtstarty((s#/sys/lib/python2.7/lib-tk/turtle.pytset_geometry�scCs|jd|�dS(NtWM_DELETE_WINDOW(twm_protocol(R�tdestroy((s#/sys/lib/python2.7/lib-tk/turtle.pyt	ondestroy�scCs
|j�S(N(twinfo_screenwidth(R�((s#/sys/lib/python2.7/lib-tk/turtle.pyt	win_width�scCs
|j�S(N(twinfo_screenheight(R�((s#/sys/lib/python2.7/lib-tk/turtle.pyt
win_height�s(
R�R�R�RR8R9R=RARCRE(((s#/sys/lib/python2.7/lib-tk/turtle.pyR3�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#/sys/lib/python2.7/lib-tk/turtle.pyt_blankimage�s
cCstjd|�S(s`return an image object containing the
        imagedata from a gif-file named filename.
        tfile(RRG(R�((s#/sys/lib/python2.7/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�R/R#txscaletyscale(R�RMtwth((s#/sys/lib/python2.7/lib-tk/turtle.pyR�s	1		cCs|jjddddd�S(s<Create an invisible polygon item on canvas self.cv)
        iR:R�toutline(iiiiii(RMtcreate_polygon(R�((s#/sys/lib/python2.7/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:RRRpN(tappendRNRORMtcoordsR�t
itemconfiguret	tag_raise(
R�tpolyitemt	coordlistR:RRRpttoptclR�R�((s#/sys/lib/python2.7/lib-tk/turtle.pyt	_drawpolyscCs.|jjdddddddddtj�S(s9Create an invisible line item on canvas self.cv)
        iR:R�Rpitcapstyle(RMtcreate_lineRtROUND(R�((s#/sys/lib/python2.7/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�RURNRORMRVRWRX(	R�tlineitemRZR:RpR[R\R�R�((s#/sys/lib/python2.7/lib-tk/turtle.pyt	_drawline*s
cCs|jj|�dS(s]Delete graphics item from canvas.
        If item is"all" delete all graphics items.
        N(RMtdelete(R�titem((s#/sys/lib/python2.7/lib-tk/turtle.pyt_deleteAscCs|jj�dS(s(Redraw graphics items on canvas
        N(RMR%(R�((s#/sys/lib/python2.7/lib-tk/turtle.pyt_updateGscCs|jj|�dS(s-Delay subsequent canvas actions for delay ms.N(RMtafter(R�R((s#/sys/lib/python2.7/lib-tk/turtle.pyt_delayLscCs=y|jj|�}t}Wntjk
r8t}nX|S(sCCheck if the string color is a legal Tkinter color string.
        (RMt	winfo_rgbR�RtTclErrorR�(R�R2trgbtok((s#/sys/lib/python2.7/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�RMR#RgR/(R�R2((s#/sys/lib/python2.7/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(RNRORMtcreate_textR-R%(R�RSttxttalignRuROR�R�RtRetx0ty0tx1ty1((s#/sys/lib/python2.7/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(RMtcanvasxR�RNtcanvasyR�RO(R,R�R�(tfunR�(s#/sys/lib/python2.7/lib-tk/turtle.pyteventfun~s!N(R�RMt
tag_unbindttag_bind(R�ReR�tnumtaddR�((R�R�s#/sys/lib/python2.7/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(RMR~R�RNRR�RO(R,R�R�(R�R�(s#/sys/lib/python2.7/lib-tk/turtle.pyR��s!N(R�RMR�R�(R�ReR�R�R�R�((R�R�s#/sys/lib/python2.7/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(RMR~R�RNRR�RO(R,R�R�(R�R�(s#/sys/lib/python2.7/lib-tk/turtle.pyR��s!N(R�RMR�R�(R�ReR�R�R�R�((R�R�s#/sys/lib/python2.7/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(RMR~R�RNRR�RO(R,R�R�(R�R�(s#/sys/lib/python2.7/lib-tk/turtle.pyR��s!N(R�RMR1R(R�R�R�R�R�((R�R�s#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyR��sN(R�RMR1R(R�R�R�R�((R�s#/sys/lib/python2.7/lib-tk/turtle.pyt_onkey�scCs|jj�dS(s=Set focus on canvas (in order to collect key-events)
        N(RMR2(R�((s#/sys/lib/python2.7/lib-tk/turtle.pyt_listen�scCs6|dkr|jj|�n|jj||�dS(s?Install a timer, which calls fun after t milliseconds.
        iN(RMt
after_idleRh(R�R�tt((s#/sys/lib/python2.7/lib-tk/turtle.pyt_ontimer�scCs|jjddd|�S(s0Create and return image item on canvas.
        itimage(RMtcreate_image(R�R�((s#/sys/lib/python2.7/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(RMRVRNROt
itemconfig(R�Ret.2R�R�R�((s#/sys/lib/python2.7/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(RMR�t	tag_lower(R�ReR�((s#/sys/lib/python2.7/lib-tk/turtle.pyt	_setbgpic�scCs|jj|�S(sQReturn 'line' or 'polygon' or 'image' depending on
        type of item.
        (RMR�(R�Re((s#/sys/lib/python2.7/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(RMRVtrangetlen(R�ReR\titpl((s#/sys/lib/python2.7/lib-tk/turtle.pyt
_pointlist�s>cCs#|jjd||||f�dS(NR"(RMR#(R�tsrx1tsry1tsrx2tsry2((s#/sys/lib/python2.7/lib-tk/turtle.pyt_setscrollregion�sc	Cs�|jj�}x�|D]z}|jj|�}g}xF|r||d \}}|j||�|j||�|d}q7W|jj||�qWdS(Ni(RMtfind_allRVRU(	R�txscalefactortyscalefactorR�RetcoordinatestnewcoordlistR�R�((s#/sys/lib/python2.7/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�RMRR�R�R�RX(R�R�R�R�((s#/sys/lib/python2.7/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�(RMR'R((R�RpR�((s#/sys/lib/python2.7/lib-tk/turtle.pyt_window_sizesN(#R�R�R�tstaticmethodRJRLRRTR�R�R]RaRcRfRgRiRnRoR}R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((s#/sys/lib/python2.7/lib-tk/turtle.pyRF�s@	
						
												t
TerminatorcBseZdZRS(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#/sys/lib/python2.7/lib-tk/turtle.pyR�+stTurtleGraphicsErrorcBseZdZRS(sSome TurtleGraphics Error
    (R�R�R�(((s#/sys/lib/python2.7/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
basestringtlowertendswithRRRLR�t_data(R�ttype_tdata((s#/sys/lib/python2.7/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�RU(R�tpolyR:RR((s#/sys/lib/python2.7/lib-tk/turtle.pytaddcomponentPs	N(R�R�R�R�RR�(((s#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyRjs		cCsb|dkr9xFt|j�D]}dg|j|<qWn||_dgg||_d|_dS(Ni�(R�R�R�R�R�(R�R�R�((s#/sys/lib/python2.7/lib-tk/turtle.pyRXos	cCs`|jdkr\|jsB|jd|j|_||j|j<q\|j|jj|�ndS(Nii(R�R�R�R�RU(R�Re((s#/sys/lib/python2.7/lib-tk/turtle.pytpushws
	cCsd|jdkr`|j|j}|dkr/dSdg|j|j<|jd|j|_|SndS(Nii(R�R�R�R�(R�Re((s#/sys/lib/python2.7/lib-tk/turtle.pytpop~scCs|j|jjdg�S(N(R�R�tcountR�(R�((s#/sys/lib/python2.7/lib-tk/turtle.pytnr_of_items�scCst|j�dt|j�S(Nt (tstrR�R�(R�((s#/sys/lib/python2.7/lib-tk/turtle.pyR��sN(
R�R�R�RR�RXR�R�R�R�(((s#/sys/lib/python2.7/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�Q��@g��Q���Q�����. ��Q�#�g$�-tsquareg������'@ttriangleR�R�RHR�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�Q��@(g�Q��@g��. @(g��Q�@g�Q�#@(ii
(g��Q���Q�#@(g�Q�����. @(g��. ��Q��@(g�Q�#���Q�@(i�i(g�Q�#���Q��g��. ��Q���g�Q�����. �g��Q���Q�#�gg$�g��Q�@g�Q�#�g�Q��@g��. �g��. @g�Q���g�Q�#@g��Q��i
i�(i
i
(i�i
(i�i�(i
g���ig���'@(i�g���ii(i�i�(ii�(ii�(RRJt_shapest_bgpicsRFRt_modet_delayvalueR�t
_colormodet_keysR.(R�RMRRR((s#/sys/lib/python2.7/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�RfR�t_bgpict
_bgpicnamet_tracingt_updatecountert_turtlesRRJR�R�RR	t_pen(R�tbtnR�((s#/sys/lib/python2.7/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�R�R�R�(R�R�(
R�R�R�R�R�R�R�RNRORX(R�R((s#/sys/lib/python2.7/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�RRNROR�R�R�R�R%(R�tllxtllyturxturytxspantyspantwxtwyt	oldxscalet	oldyscaleR�R�R�R�((s#/sys/lib/python2.7/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RLR�R�R�R�(R�tnameRc((s#/sys/lib/python2.7/lib-tk/turtle.pyRs
cCs^t|�dkr|d}nt|t�rf|j|�sI|dkrM|Stdt|���ny|\}}}Wntdt|���nX|jdkr�|||fD]}td|�^q�\}}}nd|ko�kno1d|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��i�sbad color sequence: %ss
#%02x%02x%02x(R�R�R�RnR�R�R�tround(R�R2R�tgtbR�((s#/sys/lib/python2.7/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\RQR�((s#/sys/lib/python2.7/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�N(R�R�R�R�(R�tcmode((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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�RoR�(R�R.R2((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyR�scCsRtjstt_t�n|jdkrN|jd7_|j|j;_ndS(sIncrement update counter.iiN(Rt_RUNNINGR�t	_RUNNNINGR�R�R�(R�((s#/sys/lib/python2.7/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_drawturtleRg(R�ttracingR�((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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>
        (RM(R�((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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�tremoveRUR�(R�R�R�((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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�RLR�R�(R�tpicname((s#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyRysN($R�R�R�R�R�R�RR.R�RR!RR�R�RRXR$RR#RR�R%R'R&RRRJRRRRRRRRR(((s#/sys/lib/python2.7/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�R�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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyt_setDegreesPerAU�s
	
g�@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#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyRV�scCs%|j|j|}|j|�dS(s)move turtle forward by specified distanceN(R�R�t_goto(R�R4tende((s#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyt_rotate�s
cCs
||_dS(smove turtle to position end.N(R�(R�tend((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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�@i
g�@N(R�R
R�R�R�R�R�R�RzR�R�R�R�R�(R�R�R�RStresult((s#/sys/lib/python2.7/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�@i
g�@(	R�R�R�RzR�R�R�R�R�(R�R�R�R((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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�|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�@g��@g�@iN(R�R�R�R�RfR�R�RR�tminR�R�R�R�R#RiRR�RR�(R�tradiustextenttstepsRftfracRPtw2tlttrtdlR�((s#/sys/lib/python2.7/lib-tk/turtle.pyR-=s>	.
)





	cCsdS(s/dummy method - to be overwritten by child classN((R�R�((s#/sys/lib/python2.7/lib-tk/turtle.pyRf~scCsdS(s/dummy method - to be overwritten by child classN((R�taR�((s#/sys/lib/python2.7/lib-tk/turtle.pyR#�scCsdS(s/dummy method - to be overwritten by child classN((R�R�((s#/sys/lib/python2.7/lib-tk/turtle.pyRi�sN(.R�R�R�R
R�tDEFAULT_MODER�R�RRXR�R�RR3RVRRRR<R(RWRHRSRrRsRARDRaRbR4RkRBR\R-RfR#RiR9R,R)RZRIRTR]R^R[(((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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�%@RfN(R�RR�R�RN(R�Rftspeeds((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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
stretchfactorRRRiRNN(RRRRRRRR R"R!R�tdictR%R�R�R�R�R�R�t_newLineR�R�Rg(	R�RNtpendictt_pdtpt_p_bufR�tnewLinetsf((s#/sys/lib/python2.7/lib-tk/turtle.pyRN�sz.









	

	

cCsdS(s/dummy method - to be overwritten by child classN((R�tusePos((s#/sys/lib/python2.7/lib-tk/turtle.pyR1?	scCsdS(s/dummy method - to be overwritten by child classN((R�R�tforced((s#/sys/lib/python2.7/lib-tk/turtle.pyRgA	scCsdS(s/dummy method - to be overwritten by child classN((R�R.((s#/sys/lib/python2.7/lib-tk/turtle.pyR�C	scCsdS(s/dummy method - to be overwritten by child classN((R�R.((s#/sys/lib/python2.7/lib-tk/turtle.pyR�E	sN(!R�R�R�R�RRR�RYRQRRRPRFRfR2ROR;ReRCRGRNR�R1R�RgR�R�RpRoRURMR6RgRE(((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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�RH(simagespolygon(	R�R<R�R�Rft_itemRTR�R�(R�R<R�Re((s#/sys/lib/python2.7/lib-tk/turtle.pyR;Z	s&		))(R�R�R�RR;(((s#/sys/lib/python2.7/lib-tk/turtle.pyR:Q	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�RRtscreensRURRRMR�R�RRRR�RatdrawingLineItemR:R�R�t_polyR�t
_creatingPolyt	_fillitemt	_fillpathRt_hidden_from_screentcurrentLineItemR�tcurrentLineR�t
stampItemst_undobuffersizeR�R�Rg(R�tcanvasRcR�R�R�((s#/sys/lib/python2.7/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�Rg(R�((s#/sys/lib/python2.7/lib-tk/turtle.pyRX�s




cCs+|dkrd|_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)
        N(R�R�R�(R�tsize((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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�RCRDR�R�RfRaRFRGRRUR�R0R`RI(R�Re((s#/sys/lib/python2.7/lib-tk/turtle.pyRK�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(RKRg(R�((s#/sys/lib/python2.7/lib-tk/turtle.pyR.�s
cCsd|jj�|jjdkr#dSt|j�dkr`|jj|j|j|j|j�ndS(Nii(	R�R�R�R�RGRcRFRR(R�((s#/sys/lib/python2.7/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�RgRiR�R�R$(R�R�R�((s#/sys/lib/python2.7/lib-tk/turtle.pyRg�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#/sys/lib/python2.7/lib-tk/turtle.pyR#
scCs|jj|�S(N(R�R�(R�R.((s#/sys/lib/python2.7/lib-tk/turtle.pyR�$
scCs|jj|�S(N(R�R�(R�R.((s#/sys/lib/python2.7/lib-tk/turtle.pyR�'
scCst|t�r|Sy|\}}}Wntdt|���nX|jjdkr�g|||fD]}td|�^qh\}}}nd|ko�dkno�|ko�dkno�|ko�dkns�dt|���nd|||fS(s,Convert colortriples to hexstrings.
        sbad color arguments: %sg��ii�sbad color sequence: %ss
#%02x%02x%02x(R�R�R�R�R�R�R�(R�R.R�R�R�R�((s#/sys/lib/python2.7/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�RHR�N(R�R1RR�R�RR:R<R�RUR�R�RTR=R�R�RaRFRg(R�R�R�tqtttypeRe((s#/sys/lib/python2.7/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;Rg(R�R�((s#/sys/lib/python2.7/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/RRN(R�R R"RN(R�tstretch_widtstretch_lenRRR/((s#/sys/lib/python2.7/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�@iRYR$RiN(R�R�R�R�RN(R�R�Ri((s#/sys/lib/python2.7/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�@(R!R�R�R�R�R�(R�Ri((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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
RORNR(
R�R�R�tp0tp1te0te1R~R�R�((s#/sys/lib/python2.7/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:RRRpR[R�R�NR�RH(ii(ii(ii(ii(ii(ii(R�R�R�R<R�R=RR�R�R�RER�RtmaxRR R"R!R�R�R|RWRRR]R�R�R�tzipRN(R�R�RcRPttitemttshapeRPtlxtlyRjR�R�tt0tt1tfctocReR�((s#/sys/lib/python2.7/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�|�}|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:RRRpR[R�R�R�Rh(R�R�R�R<R�R�RTRRXRR R"R!R�R�R|RWRRR]R�R�R�R�RUR�RYRNRHR�R�(R�R�RcRPR[tstitemRPR\R]RjR�R�R^R_R`RatelementReR�((s#/sys/lib/python2.7/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(
RHR�R�R�RfR�R�R�tindexR�R�tinsertR�(R�tstampidtsubitemRetbufRd((s#/sys/lib/python2.7/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(RiRg(R�Rf((s#/sys/lib/python2.7/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�RHRiRg(R�R�ttoDeleteRe((s#/sys/lib/python2.7/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�g�����R�Rpi*N(ii(ii(RRRR�RDR�R�R�RFRGR�R�R�R�RR�RNROR�R�R�R�RcR@RgRURBRAR�R1(R�Rtgo_modesR�t
undo_entrytstarttdifftdiffsqtnhopstdeltaR�R[((s#/sys/lib/python2.7/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�}|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�|j�dS(s)Reverse a _goto. Used for undo()
        g�$undogoto: HALLO-DA-STIMMT-WAS-NICHT!iR�R:RpR�iiig�����Unwahrscheinlich in _undogoto!N(ii(ii(ii(ii(R�RR�RFRGRcR�R�RfR�RR�RNROR�R�R�R�R@RgRBR�RAR�R�RD(R�tentrytoldtnewRltcoodatatdrawingtpctpstfillingtcLItcLR�R�R�tusepcR�ttodeleteRnRoRpRqRrR�R[((s#/sys/lib/python2.7/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�R�R�R�R�R�R�R�RR�RR�Rg(R�R�t	neworientR�tanglevelRRrR�((s#/sys/lib/python2.7/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�RGR�RcRFRRRaR�RUR�R�(R�R8((s#/sys/lib/python2.7/lib-tk/turtle.pyR1(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	beginfillRN(((((R�RDR�R�R�R�R]RCRRTR�RUR�R1R�R�Rg(R�RMRzR�tentry1tentry2((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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_dotR5RR#iN(R�R�R�R�RRXRR�thasattrR�R�R�R�RUR�R�RNR�R�RYRERPRQROR<R�(R�RLR2ReRN((s#/sys/lib/python2.7/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�RUR�R�(R�RwRxRuReR((s#/sys/lib/python2.7/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)
        RN(
R�R�R�R�R}R�R�RSR]R�(R�targtmoveRxRuRR�R�((s#/sys/lib/python2.7/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�RAR�RB(R�((s#/sys/lib/python2.7/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�RB(R�((s#/sys/lib/python2.7/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(RAR�R�(R�((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyR&D
s	cCs|jj|�S(sDSet delay value which determines speed of turtle animation.
        (R�R(R�R((s#/sys/lib/python2.7/lib-tk/turtle.pyRiO
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=Rg(R�R�R�R�((s#/sys/lib/python2.7/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=Rg(R�R�R�R�((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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()
        NR�RhiRkR�R5R�R:R�RRR�RN(swrisdot(ii(ii(ii(R�R�RR�R�R/RR�RfR�R�R]RCRDRRN(R�tactionR�R�tdegPAUtdummyRbRe((s#/sys/lib/python2.7/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�ReR�R�((s#/sys/lib/python2.7/lib-tk/turtle.pyRm�s

	N(R�isnormal(9R�R�R�R?R�R�RRXR`RnRKR.R�RgR#R�R�RNR1RcRdR_RjRiRWR�RhRiR/R0RRRR�R1R:R*R7R5R}R�RqR+R8R=R?R@R>R'R&RiRJRLRKR�RmRl(((s#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyR�sR>cBspeZdZdZedZd�Zededededd�Zd�Z	d�Z
d	�Zd
�ZRS(R"cCs�tjdkrKt�t_|_|jjtj�|jj|j�ntjdkr�	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�R3R"t_titleRAt_destroyRR�R8R9RRR (R�RpR�R�R�R�R�((s#/sys/lib/python2.7/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�RCRER�R�R�R=R%(R�RpR�R;R<Rptsh((s#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyR"'s
cCsV|j}|tjkr?dt_dt_dt_dt_ntt_	|j
�dS(N(R�R>R�R	R�R�RR�RR�R@(R�troot((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pytexitGracefully]sR�Ni(RJR�RvtAttributeErrortexit(R�R�((R�s#/sys/lib/python2.7/lib-tk/turtle.pyRJs


N(
R�R�R�R�RR�R�RR R"R�RR(((s#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyRrsN(R�R�R�R�R�R�R�R(((s#/sys/lib/python2.7/lib-tk/turtle.pyR	iscCs%tjdkrt�t_ntjS(s5Create the 'anonymous' turtle if not already present.N(R	R�R�(((s#/sys/lib/python2.7/lib-tk/turtle.pyt_getpenscCs%tjdkrt�t_ntjS(s-Create a TurtleScreen if not already present.N(R	R�R�R(((s#/sys/lib/python2.7/lib-tk/turtle.pyt
_getscreen�stturtle_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.pyRPR�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#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyt<lambda>�scSs||S(N((R�tdflt((s#/sys/lib/python2.7/lib-tk/turtle.pyR��siRis**s, s(%s)(R�R�t
MethodTypeR�R�t
LambdaTypet	func_codetco_argcountR�tco_varnamest
func_defaultstmapR�tco_flagsRUR(
tobtargText1targText2tfobt	argOffsettcountertitems2trealArgstdefaultstitems1((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pyt_screen_docrevise�s
s_Screen.R�s>>>>>>s6def %(key)s%(pl1)s: return _getscreen().%(key)s%(pl2)sR�tpl1tpl2sTurtle.s3def %(key)s%(pl1)s: return _getpen().%(key)s%(pl2)st__main__cCst�rt�nt�dS(N(RFRURM(((s#/sys/lib/python2.7/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#/sys/lib/python2.7/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�t�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�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�sCAUGHT! RuR�tboldRxurightR�uredcSst�t�dS(N(RR(R�R�((s#/sys/lib/python2.7/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#/sys/lib/python2.7/lib-tk/turtle.pytdemo2_s�
























	
	


















	


(LR�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�R
RRR4R3tobjectRFt	ExceptionR�R�RR�RR�RR:RR
RR>R	RR�R�RtR�t	_LANGUAGEtImportErrorR�R�R�R�R�R�R�tdefstrRvRuR�R�R�R�R(((s#/sys/lib/python2.7/lib-tk/turtle.pyt<module>es
	!


		%	4	
	c	�	/&�����k	�		"	


	$		

&

&
			5	b

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.