{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Turtle program & event handling\n", "http://openbookproject.net/thinkcs/python/english3e/hello_little_turtles.html\n", "- can't run this notebook in Colab or other online services\n", "- there are many modules in Python that provide various useful and powerful features\n", "- TKinter, turtle, email, url, http, etc.\n", "- running turtle program multiple times from jupyter notebook crashes jupyter server... so run scripts by themselves in turtle folder" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1st turtle program" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import turtle" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Help on module turtle:\n", "\n", "NAME\n", " turtle\n", "\n", "MODULE REFERENCE\n", " https://docs.python.org/3.6/library/turtle\n", " \n", " The following documentation is automatically generated from the Python\n", " source files. It may be incomplete, incorrect or include features that\n", " are considered implementation detail and may vary between Python\n", " implementations. When in doubt, consult the module reference at the\n", " location listed above.\n", "\n", "DESCRIPTION\n", " Turtle graphics is a popular way for introducing programming to\n", " kids. It was part of the original Logo programming language developed\n", " by Wally Feurzig and Seymour Papert in 1966.\n", " \n", " Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an ``import turtle``, give it\n", " the command turtle.forward(15), and it moves (on-screen!) 15 pixels in\n", " the direction it is facing, drawing a line as it moves. Give it the\n", " command turtle.right(25), and it rotates in-place 25 degrees clockwise.\n", " \n", " By combining together these and similar commands, intricate shapes and\n", " pictures can easily be drawn.\n", " \n", " ----- turtle.py\n", " \n", " This module is an extended reimplementation of turtle.py from the\n", " Python standard distribution up to Python 2.5. (See: http://www.python.org)\n", " \n", " It tries to keep the merits of turtle.py and to be (nearly) 100%\n", " compatible with it. This means in the first place to enable the\n", " learning programmer to use all the commands, classes and methods\n", " interactively when using the module from within IDLE run with\n", " the -n switch.\n", " \n", " Roughly it has the following features added:\n", " \n", " - Better animation of the turtle movements, especially of turning the\n", " turtle. So the turtles can more easily be used as a visual feedback\n", " instrument by the (beginning) programmer.\n", " \n", " - Different turtle shapes, gif-images as turtle shapes, user defined\n", " and user controllable turtle shapes, among them compound\n", " (multicolored) shapes. Turtle shapes can be stretched and tilted, which\n", " makes turtles very versatile geometrical objects.\n", " \n", " - Fine control over turtle movement and screen updates via delay(),\n", " and enhanced tracer() and speed() methods.\n", " \n", " - Aliases for the most commonly used commands, like fd for forward etc.,\n", " following the early Logo traditions. This reduces the boring work of\n", " typing long sequences of commands, which often occur in a natural way\n", " when kids try to program fancy pictures on their first encounter with\n", " turtle graphics.\n", " \n", " - Turtles now have an undo()-method with configurable undo-buffer.\n", " \n", " - Some simple commands/methods for creating event driven programs\n", " (mouse-, key-, timer-events). Especially useful for programming games.\n", " \n", " - A scrollable Canvas class. The default scrollable Canvas can be\n", " extended interactively as needed while playing around with the turtle(s).\n", " \n", " - A TurtleScreen class with methods controlling background color or\n", " background image, window and canvas size and other properties of the\n", " TurtleScreen.\n", " \n", " - There is a method, setworldcoordinates(), to install a user defined\n", " coordinate-system for the TurtleScreen.\n", " \n", " - The implementation uses a 2-vector class named Vec2D, derived from tuple.\n", " This class is public, so it can be imported by the application programmer,\n", " which makes certain types of computations very natural and compact.\n", " \n", " - Appearance of the TurtleScreen and the Turtles at startup/import can be\n", " configured by means of a turtle.cfg configuration file.\n", " The default configuration mimics the appearance of the old turtle module.\n", " \n", " - If configured appropriately the module reads in docstrings from a docstring\n", " dictionary in some different language, supplied separately and replaces\n", " the English ones by those read in. There is a utility function\n", " write_docstringdict() to write a dictionary with the original (English)\n", " docstrings to disc, so it can serve as a template for translations.\n", " \n", " Behind the scenes there are some features included with possible\n", " extensions in mind. These will be commented and documented elsewhere.\n", "\n", "CLASSES\n", " builtins.Exception(builtins.BaseException)\n", " Terminator\n", " builtins.object\n", " Shape\n", " builtins.tuple(builtins.object)\n", " Vec2D\n", " tkinter.Frame(tkinter.Widget)\n", " ScrolledCanvas\n", " TNavigator(builtins.object)\n", " RawTurtle(TPen, TNavigator)\n", " Turtle\n", " TPen(builtins.object)\n", " RawTurtle(TPen, TNavigator)\n", " Turtle\n", " TurtleScreenBase(builtins.object)\n", " TurtleScreen\n", " \n", " Pen = class Turtle(RawTurtle)\n", " | RawTurtle auto-creating (scrolled) canvas.\n", " | \n", " | When a Turtle object is created or a function derived from some\n", " | Turtle method is called a TurtleScreen object is automatically created.\n", " | \n", " | Method resolution order:\n", " | Turtle\n", " | RawTurtle\n", " | TPen\n", " | TNavigator\n", " | builtins.object\n", " | \n", " | Methods defined here:\n", " | \n", " | __init__(self, shape='classic', undobuffersize=1000, visible=True)\n", " | Initialize self. See help(type(self)) for accurate signature.\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from RawTurtle:\n", " | \n", " | begin_fill(self)\n", " | Called just before drawing a shape to be filled.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"black\", \"red\")\n", " | >>> turtle.begin_fill()\n", " | >>> turtle.circle(60)\n", " | >>> turtle.end_fill()\n", " | \n", " | begin_poly(self)\n", " | Start recording the vertices of a polygon.\n", " | \n", " | No argument.\n", " | \n", " | Start recording the vertices of a polygon. Current turtle position\n", " | is first point of polygon.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.begin_poly()\n", " | \n", " | clear(self)\n", " | Delete the turtle's drawings from the screen. Do not move turtle.\n", " | \n", " | No arguments.\n", " | \n", " | Delete the turtle's drawings from the screen. Do not move turtle.\n", " | State and position of the turtle as well as drawings of other\n", " | turtles are not affected.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.clear()\n", " | \n", " | clearstamp(self, stampid)\n", " | Delete stamp with given stampid\n", " | \n", " | Argument:\n", " | stampid - an integer, must be return value of previous stamp() call.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"blue\")\n", " | >>> astamp = turtle.stamp()\n", " | >>> turtle.fd(50)\n", " | >>> turtle.clearstamp(astamp)\n", " | \n", " | clearstamps(self, n=None)\n", " | Delete all or first/last n of turtle's stamps.\n", " | \n", " | Optional argument:\n", " | n -- an integer\n", " | \n", " | If n is None, delete all of pen's stamps,\n", " | else if n > 0 delete first n stamps\n", " | else if n < 0 delete last n stamps.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> for i in range(8):\n", " | ... turtle.stamp(); turtle.fd(30)\n", " | ...\n", " | >>> turtle.clearstamps(2)\n", " | >>> turtle.clearstamps(-2)\n", " | >>> turtle.clearstamps()\n", " | \n", " | clone(self)\n", " | Create and return a clone of the turtle.\n", " | \n", " | No argument.\n", " | \n", " | Create and return a clone of the turtle with same position, heading\n", " | and turtle properties.\n", " | \n", " | Example (for a Turtle instance named mick):\n", " | mick = Turtle()\n", " | joe = mick.clone()\n", " | \n", " | dot(self, size=None, *color)\n", " | Draw a dot with diameter size, using color.\n", " | \n", " | Optional arguments:\n", " | size -- an integer >= 1 (if given)\n", " | color -- a colorstring or a numeric color tuple\n", " | \n", " | Draw a circular dot with diameter size, using color.\n", " | If size is not given, the maximum of pensize+4 and 2*pensize is used.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.dot()\n", " | >>> turtle.fd(50); turtle.dot(20, \"blue\"); turtle.fd(50)\n", " | \n", " | end_fill(self)\n", " | Fill the shape drawn after the call begin_fill().\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"black\", \"red\")\n", " | >>> turtle.begin_fill()\n", " | >>> turtle.circle(60)\n", " | >>> turtle.end_fill()\n", " | \n", " | end_poly(self)\n", " | Stop recording the vertices of a polygon.\n", " | \n", " | No argument.\n", " | \n", " | Stop recording the vertices of a polygon. Current turtle position is\n", " | last point of polygon. This will be connected with the first point.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.end_poly()\n", " | \n", " | filling(self)\n", " | Return fillstate (True if filling, False else).\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.begin_fill()\n", " | >>> if turtle.filling():\n", " | ... turtle.pensize(5)\n", " | ... else:\n", " | ... turtle.pensize(3)\n", " | \n", " | get_poly(self)\n", " | Return the lastly recorded polygon.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> p = turtle.get_poly()\n", " | >>> turtle.register_shape(\"myFavouriteShape\", p)\n", " | \n", " | get_shapepoly(self)\n", " | Return the current shape polygon as tuple of coordinate pairs.\n", " | \n", " | No argument.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"square\")\n", " | >>> turtle.shapetransform(4, -1, 0, 2)\n", " | >>> turtle.get_shapepoly()\n", " | ((50, -20), (30, 20), (-50, 20), (-30, -20))\n", " | \n", " | getpen = getturtle(self)\n", " | Return the Turtleobject itself.\n", " | \n", " | No argument.\n", " | \n", " | Only reasonable use: as a function to return the 'anonymous turtle':\n", " | \n", " | Example:\n", " | >>> pet = getturtle()\n", " | >>> pet.fd(50)\n", " | >>> pet\n", " | \n", " | >>> turtles()\n", " | []\n", " | \n", " | getscreen(self)\n", " | Return the TurtleScreen object, the turtle is drawing on.\n", " | \n", " | No argument.\n", " | \n", " | Return the TurtleScreen object, the turtle is drawing on.\n", " | So TurtleScreen-methods can be called for that object.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> ts = turtle.getscreen()\n", " | >>> ts\n", " | \n", " | >>> ts.bgcolor(\"pink\")\n", " | \n", " | getturtle(self)\n", " | Return the Turtleobject itself.\n", " | \n", " | No argument.\n", " | \n", " | Only reasonable use: as a function to return the 'anonymous turtle':\n", " | \n", " | Example:\n", " | >>> pet = getturtle()\n", " | >>> pet.fd(50)\n", " | >>> pet\n", " | \n", " | >>> turtles()\n", " | []\n", " | \n", " | onclick(self, fun, btn=1, add=None)\n", " | Bind fun to mouse-click event on this turtle on canvas.\n", " | \n", " | Arguments:\n", " | fun -- a function with two arguments, to which will be assigned\n", " | the coordinates of the clicked point on the canvas.\n", " | num -- number of the mouse-button defaults to 1 (left mouse button).\n", " | add -- True or False. If True, new binding will be added, otherwise\n", " | it will replace a former binding.\n", " | \n", " | Example for the anonymous turtle, i. e. the procedural way:\n", " | \n", " | >>> def turn(x, y):\n", " | ... left(360)\n", " | ...\n", " | >>> onclick(turn) # Now clicking into the turtle will turn it.\n", " | >>> onclick(None) # event-binding will be removed\n", " | \n", " | ondrag(self, fun, btn=1, add=None)\n", " | Bind fun to mouse-move event on this turtle on canvas.\n", " | \n", " | Arguments:\n", " | fun -- a function with two arguments, to which will be assigned\n", " | the coordinates of the clicked point on the canvas.\n", " | num -- number of the mouse-button defaults to 1 (left mouse button).\n", " | \n", " | Every sequence of mouse-move-events on a turtle is preceded by a\n", " | mouse-click event on that turtle.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.ondrag(turtle.goto)\n", " | \n", " | Subsequently clicking and dragging a Turtle will move it\n", " | across the screen thereby producing handdrawings (if pen is\n", " | down).\n", " | \n", " | onrelease(self, fun, btn=1, add=None)\n", " | Bind fun to mouse-button-release event on this turtle on canvas.\n", " | \n", " | Arguments:\n", " | fun -- a function with two arguments, to which will be assigned\n", " | the coordinates of the clicked point on the canvas.\n", " | num -- number of the mouse-button defaults to 1 (left mouse button).\n", " | \n", " | Example (for a MyTurtle instance named joe):\n", " | >>> class MyTurtle(Turtle):\n", " | ... def glow(self,x,y):\n", " | ... self.fillcolor(\"red\")\n", " | ... def unglow(self,x,y):\n", " | ... self.fillcolor(\"\")\n", " | ...\n", " | >>> joe = MyTurtle()\n", " | >>> joe.onclick(joe.glow)\n", " | >>> joe.onrelease(joe.unglow)\n", " | \n", " | Clicking on joe turns fillcolor red, unclicking turns it to\n", " | transparent.\n", " | \n", " | reset(self)\n", " | Delete the turtle's drawings and restore its default values.\n", " | \n", " | No argument.\n", " | \n", " | Delete the turtle's drawings from the screen, re-center the turtle\n", " | and set variables to the default values.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00,-22.00)\n", " | >>> turtle.heading()\n", " | 100.0\n", " | >>> turtle.reset()\n", " | >>> turtle.position()\n", " | (0.00,0.00)\n", " | >>> turtle.heading()\n", " | 0.0\n", " | \n", " | settiltangle(self, angle)\n", " | Rotate the turtleshape to point in the specified direction\n", " | \n", " | Argument: angle -- number\n", " | \n", " | Rotate the turtleshape to point in the direction specified by angle,\n", " | regardless of its current tilt-angle. DO NOT change the turtle's\n", " | heading (direction of movement).\n", " | \n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.settiltangle(45)\n", " | >>> stamp()\n", " | >>> turtle.fd(50)\n", " | >>> turtle.settiltangle(-45)\n", " | >>> stamp()\n", " | >>> turtle.fd(50)\n", " | \n", " | setundobuffer(self, size)\n", " | Set or disable undobuffer.\n", " | \n", " | Argument:\n", " | size -- an integer or None\n", " | \n", " | If size is an integer an empty undobuffer of given size is installed.\n", " | Size gives the maximum number of turtle-actions that can be undone\n", " | by the undo() function.\n", " | If size is None, no undobuffer is present.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.setundobuffer(42)\n", " | \n", " | shape(self, name=None)\n", " | Set turtle shape to shape with given name / return current shapename.\n", " | \n", " | Optional argument:\n", " | name -- a string, which is a valid shapename\n", " | \n", " | Set turtle shape to shape with given name or, if name is not given,\n", " | return name of current shape.\n", " | Shape with name must exist in the TurtleScreen's shape dictionary.\n", " | Initially there are the following polygon shapes:\n", " | 'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'.\n", " | To learn about how to deal with shapes see Screen-method register_shape.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.shape()\n", " | 'arrow'\n", " | >>> turtle.shape(\"turtle\")\n", " | >>> turtle.shape()\n", " | 'turtle'\n", " | \n", " | shapesize(self, stretch_wid=None, stretch_len=None, outline=None)\n", " | Set/return turtle's stretchfactors/outline. Set resizemode to \"user\".\n", " | \n", " | Optional arguments:\n", " | stretch_wid : positive number\n", " | stretch_len : positive number\n", " | outline : positive number\n", " | \n", " | Return or set the pen's attributes x/y-stretchfactors and/or outline.\n", " | Set resizemode to \"user\".\n", " | If and only if resizemode is set to \"user\", the turtle will be displayed\n", " | stretched according to its stretchfactors:\n", " | stretch_wid is stretchfactor perpendicular to orientation\n", " | stretch_len is stretchfactor in direction of turtles orientation.\n", " | outline determines the width of the shapes's outline.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.resizemode(\"user\")\n", " | >>> turtle.shapesize(5, 5, 12)\n", " | >>> turtle.shapesize(outline=8)\n", " | \n", " | shapetransform(self, t11=None, t12=None, t21=None, t22=None)\n", " | Set or return the current transformation matrix of the turtle shape.\n", " | \n", " | Optional arguments: t11, t12, t21, t22 -- numbers.\n", " | \n", " | If none of the matrix elements are given, return the transformation\n", " | matrix.\n", " | Otherwise set the given elements and transform the turtleshape\n", " | according to the matrix consisting of first row t11, t12 and\n", " | second row t21, 22.\n", " | Modify stretchfactor, shearfactor and tiltangle according to the\n", " | given matrix.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"square\")\n", " | >>> turtle.shapesize(4,2)\n", " | >>> turtle.shearfactor(-0.5)\n", " | >>> turtle.shapetransform()\n", " | (4.0, -1.0, -0.0, 2.0)\n", " | \n", " | shearfactor(self, shear=None)\n", " | Set or return the current shearfactor.\n", " | \n", " | Optional argument: shear -- number, tangent of the shear angle\n", " | \n", " | Shear the turtleshape according to the given shearfactor shear,\n", " | which is the tangent of the shear angle. DO NOT change the\n", " | turtle's heading (direction of movement).\n", " | If shear is not given: return the current shearfactor, i. e. the\n", " | tangent of the shear angle, by which lines parallel to the\n", " | heading of the turtle are sheared.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.shearfactor(0.5)\n", " | >>> turtle.shearfactor()\n", " | >>> 0.5\n", " | \n", " | stamp(self)\n", " | Stamp a copy of the turtleshape onto the canvas and return its id.\n", " | \n", " | No argument.\n", " | \n", " | Stamp a copy of the turtle shape onto the canvas at the current\n", " | turtle position. Return a stamp_id for that stamp, which can be\n", " | used to delete it by calling clearstamp(stamp_id).\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"blue\")\n", " | >>> turtle.stamp()\n", " | 13\n", " | >>> turtle.fd(50)\n", " | \n", " | tilt(self, angle)\n", " | Rotate the turtleshape by angle.\n", " | \n", " | Argument:\n", " | angle - a number\n", " | \n", " | Rotate the turtleshape by angle from its current tilt-angle,\n", " | but do NOT change the turtle's heading (direction of movement).\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.tilt(30)\n", " | >>> turtle.fd(50)\n", " | >>> turtle.tilt(30)\n", " | >>> turtle.fd(50)\n", " | \n", " | tiltangle(self, angle=None)\n", " | Set or return the current tilt-angle.\n", " | \n", " | Optional argument: angle -- number\n", " | \n", " | Rotate the turtleshape to point in the direction specified by angle,\n", " | regardless of its current tilt-angle. DO NOT change the turtle's\n", " | heading (direction of movement).\n", " | If angle is not given: return the current tilt-angle, i. e. the angle\n", " | between the orientation of the turtleshape and the heading of the\n", " | turtle (its direction of movement).\n", " | \n", " | Deprecated since Python 3.1\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.tilt(45)\n", " | >>> turtle.tiltangle()\n", " | \n", " | turtlesize = shapesize(self, stretch_wid=None, stretch_len=None, outline=None)\n", " | Set/return turtle's stretchfactors/outline. Set resizemode to \"user\".\n", " | \n", " | Optional arguments:\n", " | stretch_wid : positive number\n", " | stretch_len : positive number\n", " | outline : positive number\n", " | \n", " | Return or set the pen's attributes x/y-stretchfactors and/or outline.\n", " | Set resizemode to \"user\".\n", " | If and only if resizemode is set to \"user\", the turtle will be displayed\n", " | stretched according to its stretchfactors:\n", " | stretch_wid is stretchfactor perpendicular to orientation\n", " | stretch_len is stretchfactor in direction of turtles orientation.\n", " | outline determines the width of the shapes's outline.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.resizemode(\"user\")\n", " | >>> turtle.shapesize(5, 5, 12)\n", " | >>> turtle.shapesize(outline=8)\n", " | \n", " | undo(self)\n", " | undo (repeatedly) the last turtle action.\n", " | \n", " | No argument.\n", " | \n", " | undo (repeatedly) the last turtle action.\n", " | Number of available undo actions is determined by the size of\n", " | the undobuffer.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> for i in range(4):\n", " | ... turtle.fd(50); turtle.lt(80)\n", " | ...\n", " | >>> for i in range(8):\n", " | ... turtle.undo()\n", " | ...\n", " | \n", " | undobufferentries(self)\n", " | Return count of entries in the undobuffer.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> while undobufferentries():\n", " | ... undo()\n", " | \n", " | write(self, arg, move=False, align='left', font=('Arial', 8, 'normal'))\n", " | Write text at the current turtle position.\n", " | \n", " | Arguments:\n", " | arg -- info, which is to be written to the TurtleScreen\n", " | move (optional) -- True/False\n", " | align (optional) -- one of the strings \"left\", \"center\" or right\"\n", " | font (optional) -- a triple (fontname, fontsize, fonttype)\n", " | \n", " | Write text - the string representation of arg - at the current\n", " | turtle position according to align (\"left\", \"center\" or right\")\n", " | and with the given font.\n", " | If move is True, the pen is moved to the bottom-right corner\n", " | of the text. By default, move is False.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.write('Home = ', True, align=\"center\")\n", " | >>> turtle.write((0,0), True)\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data and other attributes inherited from RawTurtle:\n", " | \n", " | screens = []\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from TPen:\n", " | \n", " | color(self, *args)\n", " | Return or set the pencolor and fillcolor.\n", " | \n", " | Arguments:\n", " | Several input formats are allowed.\n", " | They use 0, 1, 2, or 3 arguments as follows:\n", " | \n", " | color()\n", " | Return the current pencolor and the current fillcolor\n", " | as a pair of color specification strings as are returned\n", " | by pencolor and fillcolor.\n", " | color(colorstring), color((r,g,b)), color(r,g,b)\n", " | inputs as in pencolor, set both, fillcolor and pencolor,\n", " | to the given value.\n", " | color(colorstring1, colorstring2),\n", " | color((r1,g1,b1), (r2,g2,b2))\n", " | equivalent to pencolor(colorstring1) and fillcolor(colorstring2)\n", " | and analogously, if the other input format is used.\n", " | \n", " | If turtleshape is a polygon, outline and interior of that polygon\n", " | is drawn with the newly set colors.\n", " | For mor info see: pencolor, fillcolor\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color('red', 'green')\n", " | >>> turtle.color()\n", " | ('red', 'green')\n", " | >>> colormode(255)\n", " | >>> color((40, 80, 120), (160, 200, 240))\n", " | >>> color()\n", " | ('#285078', '#a0c8f0')\n", " | \n", " | down = pendown(self)\n", " | Pull the pen down -- drawing when moving.\n", " | \n", " | Aliases: pendown | pd | down\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pendown()\n", " | \n", " | fillcolor(self, *args)\n", " | Return or set the fillcolor.\n", " | \n", " | Arguments:\n", " | Four input formats are allowed:\n", " | - fillcolor()\n", " | Return the current fillcolor as color specification string,\n", " | possibly in hex-number format (see example).\n", " | May be used as input to another color/pencolor/fillcolor call.\n", " | - fillcolor(colorstring)\n", " | s is a Tk color specification string, such as \"red\" or \"yellow\"\n", " | - fillcolor((r, g, b))\n", " | *a tuple* of r, g, and b, which represent, an RGB color,\n", " | and each of r, g, and b are in the range 0..colormode,\n", " | where colormode is either 1.0 or 255\n", " | - fillcolor(r, g, b)\n", " | r, g, and b represent an RGB color, and each of r, g, and b\n", " | are in the range 0..colormode\n", " | \n", " | If turtleshape is a polygon, the interior of that polygon is drawn\n", " | with the newly set fillcolor.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.fillcolor('violet')\n", " | >>> col = turtle.pencolor()\n", " | >>> turtle.fillcolor(col)\n", " | >>> turtle.fillcolor(0, .5, 0)\n", " | \n", " | hideturtle(self)\n", " | Makes the turtle invisible.\n", " | \n", " | Aliases: hideturtle | ht\n", " | \n", " | No argument.\n", " | \n", " | It's a good idea to do this while you're in the\n", " | middle of a complicated drawing, because hiding\n", " | the turtle speeds up the drawing observably.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | \n", " | ht = hideturtle(self)\n", " | Makes the turtle invisible.\n", " | \n", " | Aliases: hideturtle | ht\n", " | \n", " | No argument.\n", " | \n", " | It's a good idea to do this while you're in the\n", " | middle of a complicated drawing, because hiding\n", " | the turtle speeds up the drawing observably.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | \n", " | isdown(self)\n", " | Return True if pen is down, False if it's up.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | >>> turtle.isdown()\n", " | False\n", " | >>> turtle.pendown()\n", " | >>> turtle.isdown()\n", " | True\n", " | \n", " | isvisible(self)\n", " | Return True if the Turtle is shown, False if it's hidden.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | >>> print turtle.isvisible():\n", " | False\n", " | \n", " | pd = pendown(self)\n", " | Pull the pen down -- drawing when moving.\n", " | \n", " | Aliases: pendown | pd | down\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pendown()\n", " | \n", " | pen(self, pen=None, **pendict)\n", " | Return or set the pen's attributes.\n", " | \n", " | Arguments:\n", " | pen -- a dictionary with some or all of the below listed keys.\n", " | **pendict -- one or more keyword-arguments with the below\n", " | listed keys as keywords.\n", " | \n", " | Return or set the pen's attributes in a 'pen-dictionary'\n", " | with the following key/value pairs:\n", " | \"shown\" : True/False\n", " | \"pendown\" : True/False\n", " | \"pencolor\" : color-string or color-tuple\n", " | \"fillcolor\" : color-string or color-tuple\n", " | \"pensize\" : positive number\n", " | \"speed\" : number in range 0..10\n", " | \"resizemode\" : \"auto\" or \"user\" or \"noresize\"\n", " | \"stretchfactor\": (positive number, positive number)\n", " | \"shearfactor\": number\n", " | \"outline\" : positive number\n", " | \"tilt\" : number\n", " | \n", " | This dictionary can be used as argument for a subsequent\n", " | pen()-call to restore the former pen-state. Moreover one\n", " | or more of these attributes can be provided as keyword-arguments.\n", " | This can be used to set several pen attributes in one statement.\n", " | \n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n", " | >>> turtle.pen()\n", " | {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " | 'pencolor': 'red', 'pendown': True, 'fillcolor': 'black',\n", " | 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " | >>> penstate=turtle.pen()\n", " | >>> turtle.color(\"yellow\",\"\")\n", " | >>> turtle.penup()\n", " | >>> turtle.pen()\n", " | {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " | 'pencolor': 'yellow', 'pendown': False, 'fillcolor': '',\n", " | 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " | >>> p.pen(penstate, fillcolor=\"green\")\n", " | >>> p.pen()\n", " | {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " | 'pencolor': 'red', 'pendown': True, 'fillcolor': 'green',\n", " | 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " | \n", " | pencolor(self, *args)\n", " | Return or set the pencolor.\n", " | \n", " | Arguments:\n", " | Four input formats are allowed:\n", " | - pencolor()\n", " | Return the current pencolor as color specification string,\n", " | possibly in hex-number format (see example).\n", " | May be used as input to another color/pencolor/fillcolor call.\n", " | - pencolor(colorstring)\n", " | s is a Tk color specification string, such as \"red\" or \"yellow\"\n", " | - pencolor((r, g, b))\n", " | *a tuple* of r, g, and b, which represent, an RGB color,\n", " | and each of r, g, and b are in the range 0..colormode,\n", " | where colormode is either 1.0 or 255\n", " | - pencolor(r, g, b)\n", " | r, g, and b represent an RGB color, and each of r, g, and b\n", " | are in the range 0..colormode\n", " | \n", " | If turtleshape is a polygon, the outline of that polygon is drawn\n", " | with the newly set pencolor.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pencolor('brown')\n", " | >>> tup = (0.2, 0.8, 0.55)\n", " | >>> turtle.pencolor(tup)\n", " | >>> turtle.pencolor()\n", " | '#33cc8c'\n", " | \n", " | pendown(self)\n", " | Pull the pen down -- drawing when moving.\n", " | \n", " | Aliases: pendown | pd | down\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pendown()\n", " | \n", " | pensize(self, width=None)\n", " | Set or return the line thickness.\n", " | \n", " | Aliases: pensize | width\n", " | \n", " | Argument:\n", " | width -- positive number\n", " | \n", " | Set the line thickness to width or return it. If resizemode is set\n", " | to \"auto\" and turtleshape is a polygon, that polygon is drawn with\n", " | the same line thickness. If no argument is given, current pensize\n", " | is returned.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pensize()\n", " | 1\n", " | >>> turtle.pensize(10) # from here on lines of width 10 are drawn\n", " | \n", " | penup(self)\n", " | Pull the pen up -- no drawing when moving.\n", " | \n", " | Aliases: penup | pu | up\n", " | \n", " | No argument\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | \n", " | pu = penup(self)\n", " | Pull the pen up -- no drawing when moving.\n", " | \n", " | Aliases: penup | pu | up\n", " | \n", " | No argument\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | \n", " | resizemode(self, rmode=None)\n", " | Set resizemode to one of the values: \"auto\", \"user\", \"noresize\".\n", " | \n", " | (Optional) Argument:\n", " | rmode -- one of the strings \"auto\", \"user\", \"noresize\"\n", " | \n", " | Different resizemodes have the following effects:\n", " | - \"auto\" adapts the appearance of the turtle\n", " | corresponding to the value of pensize.\n", " | - \"user\" adapts the appearance of the turtle according to the\n", " | values of stretchfactor and outlinewidth (outline),\n", " | which are set by shapesize()\n", " | - \"noresize\" no adaption of the turtle's appearance takes place.\n", " | If no argument is given, return current resizemode.\n", " | resizemode(\"user\") is called by a call of shapesize with arguments.\n", " | \n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.resizemode(\"noresize\")\n", " | >>> turtle.resizemode()\n", " | 'noresize'\n", " | \n", " | showturtle(self)\n", " | Makes the turtle visible.\n", " | \n", " | Aliases: showturtle | st\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | >>> turtle.showturtle()\n", " | \n", " | speed(self, speed=None)\n", " | Return or set the turtle's speed.\n", " | \n", " | Optional argument:\n", " | speed -- an integer in the range 0..10 or a speedstring (see below)\n", " | \n", " | Set the turtle's speed to an integer value in the range 0 .. 10.\n", " | If no argument is given: return current speed.\n", " | \n", " | If input is a number greater than 10 or smaller than 0.5,\n", " | speed is set to 0.\n", " | Speedstrings are mapped to speedvalues in the following way:\n", " | 'fastest' : 0\n", " | 'fast' : 10\n", " | 'normal' : 6\n", " | 'slow' : 3\n", " | 'slowest' : 1\n", " | speeds from 1 to 10 enforce increasingly faster animation of\n", " | line drawing and turtle turning.\n", " | \n", " | Attention:\n", " | speed = 0 : *no* animation takes place. forward/back makes turtle jump\n", " | and likewise left/right make the turtle turn instantly.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.speed(3)\n", " | \n", " | st = showturtle(self)\n", " | Makes the turtle visible.\n", " | \n", " | Aliases: showturtle | st\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | >>> turtle.showturtle()\n", " | \n", " | up = penup(self)\n", " | Pull the pen up -- no drawing when moving.\n", " | \n", " | Aliases: penup | pu | up\n", " | \n", " | No argument\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | \n", " | width = pensize(self, width=None)\n", " | Set or return the line thickness.\n", " | \n", " | Aliases: pensize | width\n", " | \n", " | Argument:\n", " | width -- positive number\n", " | \n", " | Set the line thickness to width or return it. If resizemode is set\n", " | to \"auto\" and turtleshape is a polygon, that polygon is drawn with\n", " | the same line thickness. If no argument is given, current pensize\n", " | is returned.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pensize()\n", " | 1\n", " | >>> turtle.pensize(10) # from here on lines of width 10 are drawn\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data descriptors inherited from TPen:\n", " | \n", " | __dict__\n", " | dictionary for instance variables (if defined)\n", " | \n", " | __weakref__\n", " | list of weak references to the object (if defined)\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from TNavigator:\n", " | \n", " | back(self, distance)\n", " | Move the turtle backward by distance.\n", " | \n", " | Aliases: back | backward | bk\n", " | \n", " | Argument:\n", " | distance -- a number\n", " | \n", " | Move the turtle backward by distance ,opposite to the direction the\n", " | turtle is headed. Do not change the turtle's heading.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.backward(30)\n", " | >>> turtle.position()\n", " | (-30.00, 0.00)\n", " | \n", " | backward = back(self, distance)\n", " | Move the turtle backward by distance.\n", " | \n", " | Aliases: back | backward | bk\n", " | \n", " | Argument:\n", " | distance -- a number\n", " | \n", " | Move the turtle backward by distance ,opposite to the direction the\n", " | turtle is headed. Do not change the turtle's heading.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.backward(30)\n", " | >>> turtle.position()\n", " | (-30.00, 0.00)\n", " | \n", " | bk = back(self, distance)\n", " | Move the turtle backward by distance.\n", " | \n", " | Aliases: back | backward | bk\n", " | \n", " | Argument:\n", " | distance -- a number\n", " | \n", " | Move the turtle backward by distance ,opposite to the direction the\n", " | turtle is headed. Do not change the turtle's heading.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.backward(30)\n", " | >>> turtle.position()\n", " | (-30.00, 0.00)\n", " | \n", " | circle(self, radius, extent=None, steps=None)\n", " | Draw a circle with given radius.\n", " | \n", " | Arguments:\n", " | radius -- a number\n", " | extent (optional) -- a number\n", " | steps (optional) -- an integer\n", " | \n", " | Draw a circle with given radius. The center is radius units left\n", " | of the turtle; extent - an angle - determines which part of the\n", " | circle is drawn. If extent is not given, draw the entire circle.\n", " | If extent is not a full circle, one endpoint of the arc is the\n", " | current pen position. Draw the arc in counterclockwise direction\n", " | if radius is positive, otherwise in clockwise direction. Finally\n", " | the direction of the turtle is changed by the amount of extent.\n", " | \n", " | As the circle is approximated by an inscribed regular polygon,\n", " | steps determines the number of steps to use. If not given,\n", " | it will be calculated automatically. Maybe used to draw regular\n", " | polygons.\n", " | \n", " | call: circle(radius) # full circle\n", " | --or: circle(radius, extent) # arc\n", " | --or: circle(radius, extent, steps)\n", " | --or: circle(radius, steps=6) # 6-sided polygon\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.circle(50)\n", " | >>> turtle.circle(120, 180) # semicircle\n", " | \n", " | degrees(self, fullcircle=360.0)\n", " | Set angle measurement units to degrees.\n", " | \n", " | Optional argument:\n", " | fullcircle - a number\n", " | \n", " | Set angle measurement units, i. e. set number\n", " | of 'degrees' for a full circle. Dafault value is\n", " | 360 degrees.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.left(90)\n", " | >>> turtle.heading()\n", " | 90\n", " | \n", " | Change angle measurement unit to grad (also known as gon,\n", " | grade, or gradian and equals 1/100-th of the right angle.)\n", " | >>> turtle.degrees(400.0)\n", " | >>> turtle.heading()\n", " | 100\n", " | \n", " | distance(self, x, y=None)\n", " | Return the distance from the turtle to (x,y) in turtle step units.\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers or a turtle instance\n", " | y -- a number None None\n", " | \n", " | call: distance(x, y) # two coordinates\n", " | --or: distance((x, y)) # a pair (tuple) of coordinates\n", " | --or: distance(vec) # e.g. as returned by pos()\n", " | --or: distance(mypen) # where mypen is another turtle\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (0.00, 0.00)\n", " | >>> turtle.distance(30,40)\n", " | 50.0\n", " | >>> pen = Turtle()\n", " | >>> pen.forward(77)\n", " | >>> turtle.distance(pen)\n", " | 77.0\n", " | \n", " | fd = forward(self, distance)\n", " | Move the turtle forward by the specified distance.\n", " | \n", " | Aliases: forward | fd\n", " | \n", " | Argument:\n", " | distance -- a number (integer or float)\n", " | \n", " | Move the turtle forward by the specified distance, in the direction\n", " | the turtle is headed.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.forward(25)\n", " | >>> turtle.position()\n", " | (25.00,0.00)\n", " | >>> turtle.forward(-75)\n", " | >>> turtle.position()\n", " | (-50.00,0.00)\n", " | \n", " | forward(self, distance)\n", " | Move the turtle forward by the specified distance.\n", " | \n", " | Aliases: forward | fd\n", " | \n", " | Argument:\n", " | distance -- a number (integer or float)\n", " | \n", " | Move the turtle forward by the specified distance, in the direction\n", " | the turtle is headed.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.forward(25)\n", " | >>> turtle.position()\n", " | (25.00,0.00)\n", " | >>> turtle.forward(-75)\n", " | >>> turtle.position()\n", " | (-50.00,0.00)\n", " | \n", " | goto(self, x, y=None)\n", " | Move turtle to an absolute position.\n", " | \n", " | Aliases: setpos | setposition | goto:\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers\n", " | y -- a number None\n", " | \n", " | call: goto(x, y) # two coordinates\n", " | --or: goto((x, y)) # a pair (tuple) of coordinates\n", " | --or: goto(vec) # e.g. as returned by pos()\n", " | \n", " | Move turtle to an absolute position. If the pen is down,\n", " | a line will be drawn. The turtle's orientation does not change.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> tp = turtle.pos()\n", " | >>> tp\n", " | (0.00, 0.00)\n", " | >>> turtle.setpos(60,30)\n", " | >>> turtle.pos()\n", " | (60.00,30.00)\n", " | >>> turtle.setpos((20,80))\n", " | >>> turtle.pos()\n", " | (20.00,80.00)\n", " | >>> turtle.setpos(tp)\n", " | >>> turtle.pos()\n", " | (0.00,0.00)\n", " | \n", " | heading(self)\n", " | Return the turtle's current heading.\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.left(67)\n", " | >>> turtle.heading()\n", " | 67.0\n", " | \n", " | home(self)\n", " | Move turtle to the origin - coordinates (0,0).\n", " | \n", " | No arguments.\n", " | \n", " | Move turtle to the origin - coordinates (0,0) and set its\n", " | heading to its start-orientation (which depends on mode).\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.home()\n", " | \n", " | left(self, angle)\n", " | Turn turtle left by angle units.\n", " | \n", " | Aliases: left | lt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle left by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.left(45)\n", " | >>> turtle.heading()\n", " | 67.0\n", " | \n", " | lt = left(self, angle)\n", " | Turn turtle left by angle units.\n", " | \n", " | Aliases: left | lt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle left by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.left(45)\n", " | >>> turtle.heading()\n", " | 67.0\n", " | \n", " | pos(self)\n", " | Return the turtle's current location (x,y), as a Vec2D-vector.\n", " | \n", " | Aliases: pos | position\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (0.00, 240.00)\n", " | \n", " | position = pos(self)\n", " | Return the turtle's current location (x,y), as a Vec2D-vector.\n", " | \n", " | Aliases: pos | position\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (0.00, 240.00)\n", " | \n", " | radians(self)\n", " | Set the angle measurement units to radians.\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 90\n", " | >>> turtle.radians()\n", " | >>> turtle.heading()\n", " | 1.5707963267948966\n", " | \n", " | right(self, angle)\n", " | Turn turtle right by angle units.\n", " | \n", " | Aliases: right | rt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle right by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.right(45)\n", " | >>> turtle.heading()\n", " | 337.0\n", " | \n", " | rt = right(self, angle)\n", " | Turn turtle right by angle units.\n", " | \n", " | Aliases: right | rt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle right by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.right(45)\n", " | >>> turtle.heading()\n", " | 337.0\n", " | \n", " | seth = setheading(self, to_angle)\n", " | Set the orientation of the turtle to to_angle.\n", " | \n", " | Aliases: setheading | seth\n", " | \n", " | Argument:\n", " | to_angle -- a number (integer or float)\n", " | \n", " | Set the orientation of the turtle to to_angle.\n", " | Here are some common directions in degrees:\n", " | \n", " | standard - mode: logo-mode:\n", " | -------------------|--------------------\n", " | 0 - east 0 - north\n", " | 90 - north 90 - east\n", " | 180 - west 180 - south\n", " | 270 - south 270 - west\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.setheading(90)\n", " | >>> turtle.heading()\n", " | 90\n", " | \n", " | setheading(self, to_angle)\n", " | Set the orientation of the turtle to to_angle.\n", " | \n", " | Aliases: setheading | seth\n", " | \n", " | Argument:\n", " | to_angle -- a number (integer or float)\n", " | \n", " | Set the orientation of the turtle to to_angle.\n", " | Here are some common directions in degrees:\n", " | \n", " | standard - mode: logo-mode:\n", " | -------------------|--------------------\n", " | 0 - east 0 - north\n", " | 90 - north 90 - east\n", " | 180 - west 180 - south\n", " | 270 - south 270 - west\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.setheading(90)\n", " | >>> turtle.heading()\n", " | 90\n", " | \n", " | setpos = goto(self, x, y=None)\n", " | Move turtle to an absolute position.\n", " | \n", " | Aliases: setpos | setposition | goto:\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers\n", " | y -- a number None\n", " | \n", " | call: goto(x, y) # two coordinates\n", " | --or: goto((x, y)) # a pair (tuple) of coordinates\n", " | --or: goto(vec) # e.g. as returned by pos()\n", " | \n", " | Move turtle to an absolute position. If the pen is down,\n", " | a line will be drawn. The turtle's orientation does not change.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> tp = turtle.pos()\n", " | >>> tp\n", " | (0.00, 0.00)\n", " | >>> turtle.setpos(60,30)\n", " | >>> turtle.pos()\n", " | (60.00,30.00)\n", " | >>> turtle.setpos((20,80))\n", " | >>> turtle.pos()\n", " | (20.00,80.00)\n", " | >>> turtle.setpos(tp)\n", " | >>> turtle.pos()\n", " | (0.00,0.00)\n", " | \n", " | setposition = goto(self, x, y=None)\n", " | Move turtle to an absolute position.\n", " | \n", " | Aliases: setpos | setposition | goto:\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers\n", " | y -- a number None\n", " | \n", " | call: goto(x, y) # two coordinates\n", " | --or: goto((x, y)) # a pair (tuple) of coordinates\n", " | --or: goto(vec) # e.g. as returned by pos()\n", " | \n", " | Move turtle to an absolute position. If the pen is down,\n", " | a line will be drawn. The turtle's orientation does not change.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> tp = turtle.pos()\n", " | >>> tp\n", " | (0.00, 0.00)\n", " | >>> turtle.setpos(60,30)\n", " | >>> turtle.pos()\n", " | (60.00,30.00)\n", " | >>> turtle.setpos((20,80))\n", " | >>> turtle.pos()\n", " | (20.00,80.00)\n", " | >>> turtle.setpos(tp)\n", " | >>> turtle.pos()\n", " | (0.00,0.00)\n", " | \n", " | setx(self, x)\n", " | Set the turtle's first coordinate to x\n", " | \n", " | Argument:\n", " | x -- a number (integer or float)\n", " | \n", " | Set the turtle's first coordinate to x, leave second coordinate\n", " | unchanged.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 240.00)\n", " | >>> turtle.setx(10)\n", " | >>> turtle.position()\n", " | (10.00, 240.00)\n", " | \n", " | sety(self, y)\n", " | Set the turtle's second coordinate to y\n", " | \n", " | Argument:\n", " | y -- a number (integer or float)\n", " | \n", " | Set the turtle's first coordinate to x, second coordinate remains\n", " | unchanged.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 40.00)\n", " | >>> turtle.sety(-10)\n", " | >>> turtle.position()\n", " | (0.00, -10.00)\n", " | \n", " | towards(self, x, y=None)\n", " | Return the angle of the line from the turtle's position to (x, y).\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers or a turtle instance\n", " | y -- a number None None\n", " | \n", " | call: distance(x, y) # two coordinates\n", " | --or: distance((x, y)) # a pair (tuple) of coordinates\n", " | --or: distance(vec) # e.g. as returned by pos()\n", " | --or: distance(mypen) # where mypen is another turtle\n", " | \n", " | Return the angle, between the line from turtle-position to position\n", " | specified by x, y and the turtle's start orientation. (Depends on\n", " | modes - \"standard\" or \"logo\")\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (10.00, 10.00)\n", " | >>> turtle.towards(0,0)\n", " | 225.0\n", " | \n", " | xcor(self)\n", " | Return the turtle's x coordinate.\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> reset()\n", " | >>> turtle.left(60)\n", " | >>> turtle.forward(100)\n", " | >>> print turtle.xcor()\n", " | 50.0\n", " | \n", " | ycor(self)\n", " | Return the turtle's y coordinate\n", " | ---\n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> reset()\n", " | >>> turtle.left(60)\n", " | >>> turtle.forward(100)\n", " | >>> print turtle.ycor()\n", " | 86.6025403784\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data and other attributes inherited from TNavigator:\n", " | \n", " | DEFAULT_ANGLEOFFSET = 0\n", " | \n", " | DEFAULT_ANGLEORIENT = 1\n", " | \n", " | DEFAULT_MODE = 'standard'\n", " | \n", " | START_ORIENTATION = {'logo': (0.00,1.00), 'standard': (1.00,0.00), 'wo...\n", " \n", " RawPen = class RawTurtle(TPen, TNavigator)\n", " | Animation part of the RawTurtle.\n", " | Puts RawTurtle upon a TurtleScreen and provides tools for\n", " | its animation.\n", " | \n", " | Method resolution order:\n", " | RawTurtle\n", " | TPen\n", " | TNavigator\n", " | builtins.object\n", " | \n", " | Methods defined here:\n", " | \n", " | __init__(self, canvas=None, shape='classic', undobuffersize=1000, visible=True)\n", " | Initialize self. See help(type(self)) for accurate signature.\n", " | \n", " | begin_fill(self)\n", " | Called just before drawing a shape to be filled.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"black\", \"red\")\n", " | >>> turtle.begin_fill()\n", " | >>> turtle.circle(60)\n", " | >>> turtle.end_fill()\n", " | \n", " | begin_poly(self)\n", " | Start recording the vertices of a polygon.\n", " | \n", " | No argument.\n", " | \n", " | Start recording the vertices of a polygon. Current turtle position\n", " | is first point of polygon.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.begin_poly()\n", " | \n", " | clear(self)\n", " | Delete the turtle's drawings from the screen. Do not move turtle.\n", " | \n", " | No arguments.\n", " | \n", " | Delete the turtle's drawings from the screen. Do not move turtle.\n", " | State and position of the turtle as well as drawings of other\n", " | turtles are not affected.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.clear()\n", " | \n", " | clearstamp(self, stampid)\n", " | Delete stamp with given stampid\n", " | \n", " | Argument:\n", " | stampid - an integer, must be return value of previous stamp() call.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"blue\")\n", " | >>> astamp = turtle.stamp()\n", " | >>> turtle.fd(50)\n", " | >>> turtle.clearstamp(astamp)\n", " | \n", " | clearstamps(self, n=None)\n", " | Delete all or first/last n of turtle's stamps.\n", " | \n", " | Optional argument:\n", " | n -- an integer\n", " | \n", " | If n is None, delete all of pen's stamps,\n", " | else if n > 0 delete first n stamps\n", " | else if n < 0 delete last n stamps.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> for i in range(8):\n", " | ... turtle.stamp(); turtle.fd(30)\n", " | ...\n", " | >>> turtle.clearstamps(2)\n", " | >>> turtle.clearstamps(-2)\n", " | >>> turtle.clearstamps()\n", " | \n", " | clone(self)\n", " | Create and return a clone of the turtle.\n", " | \n", " | No argument.\n", " | \n", " | Create and return a clone of the turtle with same position, heading\n", " | and turtle properties.\n", " | \n", " | Example (for a Turtle instance named mick):\n", " | mick = Turtle()\n", " | joe = mick.clone()\n", " | \n", " | dot(self, size=None, *color)\n", " | Draw a dot with diameter size, using color.\n", " | \n", " | Optional arguments:\n", " | size -- an integer >= 1 (if given)\n", " | color -- a colorstring or a numeric color tuple\n", " | \n", " | Draw a circular dot with diameter size, using color.\n", " | If size is not given, the maximum of pensize+4 and 2*pensize is used.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.dot()\n", " | >>> turtle.fd(50); turtle.dot(20, \"blue\"); turtle.fd(50)\n", " | \n", " | end_fill(self)\n", " | Fill the shape drawn after the call begin_fill().\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"black\", \"red\")\n", " | >>> turtle.begin_fill()\n", " | >>> turtle.circle(60)\n", " | >>> turtle.end_fill()\n", " | \n", " | end_poly(self)\n", " | Stop recording the vertices of a polygon.\n", " | \n", " | No argument.\n", " | \n", " | Stop recording the vertices of a polygon. Current turtle position is\n", " | last point of polygon. This will be connected with the first point.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.end_poly()\n", " | \n", " | filling(self)\n", " | Return fillstate (True if filling, False else).\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.begin_fill()\n", " | >>> if turtle.filling():\n", " | ... turtle.pensize(5)\n", " | ... else:\n", " | ... turtle.pensize(3)\n", " | \n", " | get_poly(self)\n", " | Return the lastly recorded polygon.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> p = turtle.get_poly()\n", " | >>> turtle.register_shape(\"myFavouriteShape\", p)\n", " | \n", " | get_shapepoly(self)\n", " | Return the current shape polygon as tuple of coordinate pairs.\n", " | \n", " | No argument.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"square\")\n", " | >>> turtle.shapetransform(4, -1, 0, 2)\n", " | >>> turtle.get_shapepoly()\n", " | ((50, -20), (30, 20), (-50, 20), (-30, -20))\n", " | \n", " | getpen = getturtle(self)\n", " | \n", " | getscreen(self)\n", " | Return the TurtleScreen object, the turtle is drawing on.\n", " | \n", " | No argument.\n", " | \n", " | Return the TurtleScreen object, the turtle is drawing on.\n", " | So TurtleScreen-methods can be called for that object.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> ts = turtle.getscreen()\n", " | >>> ts\n", " | \n", " | >>> ts.bgcolor(\"pink\")\n", " | \n", " | getturtle(self)\n", " | Return the Turtleobject itself.\n", " | \n", " | No argument.\n", " | \n", " | Only reasonable use: as a function to return the 'anonymous turtle':\n", " | \n", " | Example:\n", " | >>> pet = getturtle()\n", " | >>> pet.fd(50)\n", " | >>> pet\n", " | \n", " | >>> turtles()\n", " | []\n", " | \n", " | onclick(self, fun, btn=1, add=None)\n", " | Bind fun to mouse-click event on this turtle on canvas.\n", " | \n", " | Arguments:\n", " | fun -- a function with two arguments, to which will be assigned\n", " | the coordinates of the clicked point on the canvas.\n", " | num -- number of the mouse-button defaults to 1 (left mouse button).\n", " | add -- True or False. If True, new binding will be added, otherwise\n", " | it will replace a former binding.\n", " | \n", " | Example for the anonymous turtle, i. e. the procedural way:\n", " | \n", " | >>> def turn(x, y):\n", " | ... left(360)\n", " | ...\n", " | >>> onclick(turn) # Now clicking into the turtle will turn it.\n", " | >>> onclick(None) # event-binding will be removed\n", " | \n", " | ondrag(self, fun, btn=1, add=None)\n", " | Bind fun to mouse-move event on this turtle on canvas.\n", " | \n", " | Arguments:\n", " | fun -- a function with two arguments, to which will be assigned\n", " | the coordinates of the clicked point on the canvas.\n", " | num -- number of the mouse-button defaults to 1 (left mouse button).\n", " | \n", " | Every sequence of mouse-move-events on a turtle is preceded by a\n", " | mouse-click event on that turtle.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.ondrag(turtle.goto)\n", " | \n", " | Subsequently clicking and dragging a Turtle will move it\n", " | across the screen thereby producing handdrawings (if pen is\n", " | down).\n", " | \n", " | onrelease(self, fun, btn=1, add=None)\n", " | Bind fun to mouse-button-release event on this turtle on canvas.\n", " | \n", " | Arguments:\n", " | fun -- a function with two arguments, to which will be assigned\n", " | the coordinates of the clicked point on the canvas.\n", " | num -- number of the mouse-button defaults to 1 (left mouse button).\n", " | \n", " | Example (for a MyTurtle instance named joe):\n", " | >>> class MyTurtle(Turtle):\n", " | ... def glow(self,x,y):\n", " | ... self.fillcolor(\"red\")\n", " | ... def unglow(self,x,y):\n", " | ... self.fillcolor(\"\")\n", " | ...\n", " | >>> joe = MyTurtle()\n", " | >>> joe.onclick(joe.glow)\n", " | >>> joe.onrelease(joe.unglow)\n", " | \n", " | Clicking on joe turns fillcolor red, unclicking turns it to\n", " | transparent.\n", " | \n", " | reset(self)\n", " | Delete the turtle's drawings and restore its default values.\n", " | \n", " | No argument.\n", " | \n", " | Delete the turtle's drawings from the screen, re-center the turtle\n", " | and set variables to the default values.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00,-22.00)\n", " | >>> turtle.heading()\n", " | 100.0\n", " | >>> turtle.reset()\n", " | >>> turtle.position()\n", " | (0.00,0.00)\n", " | >>> turtle.heading()\n", " | 0.0\n", " | \n", " | settiltangle(self, angle)\n", " | Rotate the turtleshape to point in the specified direction\n", " | \n", " | Argument: angle -- number\n", " | \n", " | Rotate the turtleshape to point in the direction specified by angle,\n", " | regardless of its current tilt-angle. DO NOT change the turtle's\n", " | heading (direction of movement).\n", " | \n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.settiltangle(45)\n", " | >>> stamp()\n", " | >>> turtle.fd(50)\n", " | >>> turtle.settiltangle(-45)\n", " | >>> stamp()\n", " | >>> turtle.fd(50)\n", " | \n", " | setundobuffer(self, size)\n", " | Set or disable undobuffer.\n", " | \n", " | Argument:\n", " | size -- an integer or None\n", " | \n", " | If size is an integer an empty undobuffer of given size is installed.\n", " | Size gives the maximum number of turtle-actions that can be undone\n", " | by the undo() function.\n", " | If size is None, no undobuffer is present.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.setundobuffer(42)\n", " | \n", " | shape(self, name=None)\n", " | Set turtle shape to shape with given name / return current shapename.\n", " | \n", " | Optional argument:\n", " | name -- a string, which is a valid shapename\n", " | \n", " | Set turtle shape to shape with given name or, if name is not given,\n", " | return name of current shape.\n", " | Shape with name must exist in the TurtleScreen's shape dictionary.\n", " | Initially there are the following polygon shapes:\n", " | 'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'.\n", " | To learn about how to deal with shapes see Screen-method register_shape.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.shape()\n", " | 'arrow'\n", " | >>> turtle.shape(\"turtle\")\n", " | >>> turtle.shape()\n", " | 'turtle'\n", " | \n", " | shapesize(self, stretch_wid=None, stretch_len=None, outline=None)\n", " | Set/return turtle's stretchfactors/outline. Set resizemode to \"user\".\n", " | \n", " | Optional arguments:\n", " | stretch_wid : positive number\n", " | stretch_len : positive number\n", " | outline : positive number\n", " | \n", " | Return or set the pen's attributes x/y-stretchfactors and/or outline.\n", " | Set resizemode to \"user\".\n", " | If and only if resizemode is set to \"user\", the turtle will be displayed\n", " | stretched according to its stretchfactors:\n", " | stretch_wid is stretchfactor perpendicular to orientation\n", " | stretch_len is stretchfactor in direction of turtles orientation.\n", " | outline determines the width of the shapes's outline.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.resizemode(\"user\")\n", " | >>> turtle.shapesize(5, 5, 12)\n", " | >>> turtle.shapesize(outline=8)\n", " | \n", " | shapetransform(self, t11=None, t12=None, t21=None, t22=None)\n", " | Set or return the current transformation matrix of the turtle shape.\n", " | \n", " | Optional arguments: t11, t12, t21, t22 -- numbers.\n", " | \n", " | If none of the matrix elements are given, return the transformation\n", " | matrix.\n", " | Otherwise set the given elements and transform the turtleshape\n", " | according to the matrix consisting of first row t11, t12 and\n", " | second row t21, 22.\n", " | Modify stretchfactor, shearfactor and tiltangle according to the\n", " | given matrix.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"square\")\n", " | >>> turtle.shapesize(4,2)\n", " | >>> turtle.shearfactor(-0.5)\n", " | >>> turtle.shapetransform()\n", " | (4.0, -1.0, -0.0, 2.0)\n", " | \n", " | shearfactor(self, shear=None)\n", " | Set or return the current shearfactor.\n", " | \n", " | Optional argument: shear -- number, tangent of the shear angle\n", " | \n", " | Shear the turtleshape according to the given shearfactor shear,\n", " | which is the tangent of the shear angle. DO NOT change the\n", " | turtle's heading (direction of movement).\n", " | If shear is not given: return the current shearfactor, i. e. the\n", " | tangent of the shear angle, by which lines parallel to the\n", " | heading of the turtle are sheared.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.shearfactor(0.5)\n", " | >>> turtle.shearfactor()\n", " | >>> 0.5\n", " | \n", " | stamp(self)\n", " | Stamp a copy of the turtleshape onto the canvas and return its id.\n", " | \n", " | No argument.\n", " | \n", " | Stamp a copy of the turtle shape onto the canvas at the current\n", " | turtle position. Return a stamp_id for that stamp, which can be\n", " | used to delete it by calling clearstamp(stamp_id).\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"blue\")\n", " | >>> turtle.stamp()\n", " | 13\n", " | >>> turtle.fd(50)\n", " | \n", " | tilt(self, angle)\n", " | Rotate the turtleshape by angle.\n", " | \n", " | Argument:\n", " | angle - a number\n", " | \n", " | Rotate the turtleshape by angle from its current tilt-angle,\n", " | but do NOT change the turtle's heading (direction of movement).\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.tilt(30)\n", " | >>> turtle.fd(50)\n", " | >>> turtle.tilt(30)\n", " | >>> turtle.fd(50)\n", " | \n", " | tiltangle(self, angle=None)\n", " | Set or return the current tilt-angle.\n", " | \n", " | Optional argument: angle -- number\n", " | \n", " | Rotate the turtleshape to point in the direction specified by angle,\n", " | regardless of its current tilt-angle. DO NOT change the turtle's\n", " | heading (direction of movement).\n", " | If angle is not given: return the current tilt-angle, i. e. the angle\n", " | between the orientation of the turtleshape and the heading of the\n", " | turtle (its direction of movement).\n", " | \n", " | Deprecated since Python 3.1\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.tilt(45)\n", " | >>> turtle.tiltangle()\n", " | \n", " | turtlesize = shapesize(self, stretch_wid=None, stretch_len=None, outline=None)\n", " | \n", " | undo(self)\n", " | undo (repeatedly) the last turtle action.\n", " | \n", " | No argument.\n", " | \n", " | undo (repeatedly) the last turtle action.\n", " | Number of available undo actions is determined by the size of\n", " | the undobuffer.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> for i in range(4):\n", " | ... turtle.fd(50); turtle.lt(80)\n", " | ...\n", " | >>> for i in range(8):\n", " | ... turtle.undo()\n", " | ...\n", " | \n", " | undobufferentries(self)\n", " | Return count of entries in the undobuffer.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> while undobufferentries():\n", " | ... undo()\n", " | \n", " | write(self, arg, move=False, align='left', font=('Arial', 8, 'normal'))\n", " | Write text at the current turtle position.\n", " | \n", " | Arguments:\n", " | arg -- info, which is to be written to the TurtleScreen\n", " | move (optional) -- True/False\n", " | align (optional) -- one of the strings \"left\", \"center\" or right\"\n", " | font (optional) -- a triple (fontname, fontsize, fonttype)\n", " | \n", " | Write text - the string representation of arg - at the current\n", " | turtle position according to align (\"left\", \"center\" or right\")\n", " | and with the given font.\n", " | If move is True, the pen is moved to the bottom-right corner\n", " | of the text. By default, move is False.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.write('Home = ', True, align=\"center\")\n", " | >>> turtle.write((0,0), True)\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data and other attributes defined here:\n", " | \n", " | screens = []\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from TPen:\n", " | \n", " | color(self, *args)\n", " | Return or set the pencolor and fillcolor.\n", " | \n", " | Arguments:\n", " | Several input formats are allowed.\n", " | They use 0, 1, 2, or 3 arguments as follows:\n", " | \n", " | color()\n", " | Return the current pencolor and the current fillcolor\n", " | as a pair of color specification strings as are returned\n", " | by pencolor and fillcolor.\n", " | color(colorstring), color((r,g,b)), color(r,g,b)\n", " | inputs as in pencolor, set both, fillcolor and pencolor,\n", " | to the given value.\n", " | color(colorstring1, colorstring2),\n", " | color((r1,g1,b1), (r2,g2,b2))\n", " | equivalent to pencolor(colorstring1) and fillcolor(colorstring2)\n", " | and analogously, if the other input format is used.\n", " | \n", " | If turtleshape is a polygon, outline and interior of that polygon\n", " | is drawn with the newly set colors.\n", " | For mor info see: pencolor, fillcolor\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color('red', 'green')\n", " | >>> turtle.color()\n", " | ('red', 'green')\n", " | >>> colormode(255)\n", " | >>> color((40, 80, 120), (160, 200, 240))\n", " | >>> color()\n", " | ('#285078', '#a0c8f0')\n", " | \n", " | down = pendown(self)\n", " | Pull the pen down -- drawing when moving.\n", " | \n", " | Aliases: pendown | pd | down\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pendown()\n", " | \n", " | fillcolor(self, *args)\n", " | Return or set the fillcolor.\n", " | \n", " | Arguments:\n", " | Four input formats are allowed:\n", " | - fillcolor()\n", " | Return the current fillcolor as color specification string,\n", " | possibly in hex-number format (see example).\n", " | May be used as input to another color/pencolor/fillcolor call.\n", " | - fillcolor(colorstring)\n", " | s is a Tk color specification string, such as \"red\" or \"yellow\"\n", " | - fillcolor((r, g, b))\n", " | *a tuple* of r, g, and b, which represent, an RGB color,\n", " | and each of r, g, and b are in the range 0..colormode,\n", " | where colormode is either 1.0 or 255\n", " | - fillcolor(r, g, b)\n", " | r, g, and b represent an RGB color, and each of r, g, and b\n", " | are in the range 0..colormode\n", " | \n", " | If turtleshape is a polygon, the interior of that polygon is drawn\n", " | with the newly set fillcolor.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.fillcolor('violet')\n", " | >>> col = turtle.pencolor()\n", " | >>> turtle.fillcolor(col)\n", " | >>> turtle.fillcolor(0, .5, 0)\n", " | \n", " | hideturtle(self)\n", " | Makes the turtle invisible.\n", " | \n", " | Aliases: hideturtle | ht\n", " | \n", " | No argument.\n", " | \n", " | It's a good idea to do this while you're in the\n", " | middle of a complicated drawing, because hiding\n", " | the turtle speeds up the drawing observably.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | \n", " | ht = hideturtle(self)\n", " | Makes the turtle invisible.\n", " | \n", " | Aliases: hideturtle | ht\n", " | \n", " | No argument.\n", " | \n", " | It's a good idea to do this while you're in the\n", " | middle of a complicated drawing, because hiding\n", " | the turtle speeds up the drawing observably.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | \n", " | isdown(self)\n", " | Return True if pen is down, False if it's up.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | >>> turtle.isdown()\n", " | False\n", " | >>> turtle.pendown()\n", " | >>> turtle.isdown()\n", " | True\n", " | \n", " | isvisible(self)\n", " | Return True if the Turtle is shown, False if it's hidden.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | >>> print turtle.isvisible():\n", " | False\n", " | \n", " | pd = pendown(self)\n", " | Pull the pen down -- drawing when moving.\n", " | \n", " | Aliases: pendown | pd | down\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pendown()\n", " | \n", " | pen(self, pen=None, **pendict)\n", " | Return or set the pen's attributes.\n", " | \n", " | Arguments:\n", " | pen -- a dictionary with some or all of the below listed keys.\n", " | **pendict -- one or more keyword-arguments with the below\n", " | listed keys as keywords.\n", " | \n", " | Return or set the pen's attributes in a 'pen-dictionary'\n", " | with the following key/value pairs:\n", " | \"shown\" : True/False\n", " | \"pendown\" : True/False\n", " | \"pencolor\" : color-string or color-tuple\n", " | \"fillcolor\" : color-string or color-tuple\n", " | \"pensize\" : positive number\n", " | \"speed\" : number in range 0..10\n", " | \"resizemode\" : \"auto\" or \"user\" or \"noresize\"\n", " | \"stretchfactor\": (positive number, positive number)\n", " | \"shearfactor\": number\n", " | \"outline\" : positive number\n", " | \"tilt\" : number\n", " | \n", " | This dictionary can be used as argument for a subsequent\n", " | pen()-call to restore the former pen-state. Moreover one\n", " | or more of these attributes can be provided as keyword-arguments.\n", " | This can be used to set several pen attributes in one statement.\n", " | \n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n", " | >>> turtle.pen()\n", " | {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " | 'pencolor': 'red', 'pendown': True, 'fillcolor': 'black',\n", " | 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " | >>> penstate=turtle.pen()\n", " | >>> turtle.color(\"yellow\",\"\")\n", " | >>> turtle.penup()\n", " | >>> turtle.pen()\n", " | {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " | 'pencolor': 'yellow', 'pendown': False, 'fillcolor': '',\n", " | 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " | >>> p.pen(penstate, fillcolor=\"green\")\n", " | >>> p.pen()\n", " | {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " | 'pencolor': 'red', 'pendown': True, 'fillcolor': 'green',\n", " | 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " | \n", " | pencolor(self, *args)\n", " | Return or set the pencolor.\n", " | \n", " | Arguments:\n", " | Four input formats are allowed:\n", " | - pencolor()\n", " | Return the current pencolor as color specification string,\n", " | possibly in hex-number format (see example).\n", " | May be used as input to another color/pencolor/fillcolor call.\n", " | - pencolor(colorstring)\n", " | s is a Tk color specification string, such as \"red\" or \"yellow\"\n", " | - pencolor((r, g, b))\n", " | *a tuple* of r, g, and b, which represent, an RGB color,\n", " | and each of r, g, and b are in the range 0..colormode,\n", " | where colormode is either 1.0 or 255\n", " | - pencolor(r, g, b)\n", " | r, g, and b represent an RGB color, and each of r, g, and b\n", " | are in the range 0..colormode\n", " | \n", " | If turtleshape is a polygon, the outline of that polygon is drawn\n", " | with the newly set pencolor.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pencolor('brown')\n", " | >>> tup = (0.2, 0.8, 0.55)\n", " | >>> turtle.pencolor(tup)\n", " | >>> turtle.pencolor()\n", " | '#33cc8c'\n", " | \n", " | pendown(self)\n", " | Pull the pen down -- drawing when moving.\n", " | \n", " | Aliases: pendown | pd | down\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pendown()\n", " | \n", " | pensize(self, width=None)\n", " | Set or return the line thickness.\n", " | \n", " | Aliases: pensize | width\n", " | \n", " | Argument:\n", " | width -- positive number\n", " | \n", " | Set the line thickness to width or return it. If resizemode is set\n", " | to \"auto\" and turtleshape is a polygon, that polygon is drawn with\n", " | the same line thickness. If no argument is given, current pensize\n", " | is returned.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pensize()\n", " | 1\n", " | >>> turtle.pensize(10) # from here on lines of width 10 are drawn\n", " | \n", " | penup(self)\n", " | Pull the pen up -- no drawing when moving.\n", " | \n", " | Aliases: penup | pu | up\n", " | \n", " | No argument\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | \n", " | pu = penup(self)\n", " | Pull the pen up -- no drawing when moving.\n", " | \n", " | Aliases: penup | pu | up\n", " | \n", " | No argument\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | \n", " | resizemode(self, rmode=None)\n", " | Set resizemode to one of the values: \"auto\", \"user\", \"noresize\".\n", " | \n", " | (Optional) Argument:\n", " | rmode -- one of the strings \"auto\", \"user\", \"noresize\"\n", " | \n", " | Different resizemodes have the following effects:\n", " | - \"auto\" adapts the appearance of the turtle\n", " | corresponding to the value of pensize.\n", " | - \"user\" adapts the appearance of the turtle according to the\n", " | values of stretchfactor and outlinewidth (outline),\n", " | which are set by shapesize()\n", " | - \"noresize\" no adaption of the turtle's appearance takes place.\n", " | If no argument is given, return current resizemode.\n", " | resizemode(\"user\") is called by a call of shapesize with arguments.\n", " | \n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.resizemode(\"noresize\")\n", " | >>> turtle.resizemode()\n", " | 'noresize'\n", " | \n", " | showturtle(self)\n", " | Makes the turtle visible.\n", " | \n", " | Aliases: showturtle | st\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | >>> turtle.showturtle()\n", " | \n", " | speed(self, speed=None)\n", " | Return or set the turtle's speed.\n", " | \n", " | Optional argument:\n", " | speed -- an integer in the range 0..10 or a speedstring (see below)\n", " | \n", " | Set the turtle's speed to an integer value in the range 0 .. 10.\n", " | If no argument is given: return current speed.\n", " | \n", " | If input is a number greater than 10 or smaller than 0.5,\n", " | speed is set to 0.\n", " | Speedstrings are mapped to speedvalues in the following way:\n", " | 'fastest' : 0\n", " | 'fast' : 10\n", " | 'normal' : 6\n", " | 'slow' : 3\n", " | 'slowest' : 1\n", " | speeds from 1 to 10 enforce increasingly faster animation of\n", " | line drawing and turtle turning.\n", " | \n", " | Attention:\n", " | speed = 0 : *no* animation takes place. forward/back makes turtle jump\n", " | and likewise left/right make the turtle turn instantly.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.speed(3)\n", " | \n", " | st = showturtle(self)\n", " | Makes the turtle visible.\n", " | \n", " | Aliases: showturtle | st\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | >>> turtle.showturtle()\n", " | \n", " | up = penup(self)\n", " | Pull the pen up -- no drawing when moving.\n", " | \n", " | Aliases: penup | pu | up\n", " | \n", " | No argument\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | \n", " | width = pensize(self, width=None)\n", " | Set or return the line thickness.\n", " | \n", " | Aliases: pensize | width\n", " | \n", " | Argument:\n", " | width -- positive number\n", " | \n", " | Set the line thickness to width or return it. If resizemode is set\n", " | to \"auto\" and turtleshape is a polygon, that polygon is drawn with\n", " | the same line thickness. If no argument is given, current pensize\n", " | is returned.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pensize()\n", " | 1\n", " | >>> turtle.pensize(10) # from here on lines of width 10 are drawn\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data descriptors inherited from TPen:\n", " | \n", " | __dict__\n", " | dictionary for instance variables (if defined)\n", " | \n", " | __weakref__\n", " | list of weak references to the object (if defined)\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from TNavigator:\n", " | \n", " | back(self, distance)\n", " | Move the turtle backward by distance.\n", " | \n", " | Aliases: back | backward | bk\n", " | \n", " | Argument:\n", " | distance -- a number\n", " | \n", " | Move the turtle backward by distance ,opposite to the direction the\n", " | turtle is headed. Do not change the turtle's heading.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.backward(30)\n", " | >>> turtle.position()\n", " | (-30.00, 0.00)\n", " | \n", " | backward = back(self, distance)\n", " | Move the turtle backward by distance.\n", " | \n", " | Aliases: back | backward | bk\n", " | \n", " | Argument:\n", " | distance -- a number\n", " | \n", " | Move the turtle backward by distance ,opposite to the direction the\n", " | turtle is headed. Do not change the turtle's heading.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.backward(30)\n", " | >>> turtle.position()\n", " | (-30.00, 0.00)\n", " | \n", " | bk = back(self, distance)\n", " | Move the turtle backward by distance.\n", " | \n", " | Aliases: back | backward | bk\n", " | \n", " | Argument:\n", " | distance -- a number\n", " | \n", " | Move the turtle backward by distance ,opposite to the direction the\n", " | turtle is headed. Do not change the turtle's heading.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.backward(30)\n", " | >>> turtle.position()\n", " | (-30.00, 0.00)\n", " | \n", " | circle(self, radius, extent=None, steps=None)\n", " | Draw a circle with given radius.\n", " | \n", " | Arguments:\n", " | radius -- a number\n", " | extent (optional) -- a number\n", " | steps (optional) -- an integer\n", " | \n", " | Draw a circle with given radius. The center is radius units left\n", " | of the turtle; extent - an angle - determines which part of the\n", " | circle is drawn. If extent is not given, draw the entire circle.\n", " | If extent is not a full circle, one endpoint of the arc is the\n", " | current pen position. Draw the arc in counterclockwise direction\n", " | if radius is positive, otherwise in clockwise direction. Finally\n", " | the direction of the turtle is changed by the amount of extent.\n", " | \n", " | As the circle is approximated by an inscribed regular polygon,\n", " | steps determines the number of steps to use. If not given,\n", " | it will be calculated automatically. Maybe used to draw regular\n", " | polygons.\n", " | \n", " | call: circle(radius) # full circle\n", " | --or: circle(radius, extent) # arc\n", " | --or: circle(radius, extent, steps)\n", " | --or: circle(radius, steps=6) # 6-sided polygon\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.circle(50)\n", " | >>> turtle.circle(120, 180) # semicircle\n", " | \n", " | degrees(self, fullcircle=360.0)\n", " | Set angle measurement units to degrees.\n", " | \n", " | Optional argument:\n", " | fullcircle - a number\n", " | \n", " | Set angle measurement units, i. e. set number\n", " | of 'degrees' for a full circle. Dafault value is\n", " | 360 degrees.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.left(90)\n", " | >>> turtle.heading()\n", " | 90\n", " | \n", " | Change angle measurement unit to grad (also known as gon,\n", " | grade, or gradian and equals 1/100-th of the right angle.)\n", " | >>> turtle.degrees(400.0)\n", " | >>> turtle.heading()\n", " | 100\n", " | \n", " | distance(self, x, y=None)\n", " | Return the distance from the turtle to (x,y) in turtle step units.\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers or a turtle instance\n", " | y -- a number None None\n", " | \n", " | call: distance(x, y) # two coordinates\n", " | --or: distance((x, y)) # a pair (tuple) of coordinates\n", " | --or: distance(vec) # e.g. as returned by pos()\n", " | --or: distance(mypen) # where mypen is another turtle\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (0.00, 0.00)\n", " | >>> turtle.distance(30,40)\n", " | 50.0\n", " | >>> pen = Turtle()\n", " | >>> pen.forward(77)\n", " | >>> turtle.distance(pen)\n", " | 77.0\n", " | \n", " | fd = forward(self, distance)\n", " | Move the turtle forward by the specified distance.\n", " | \n", " | Aliases: forward | fd\n", " | \n", " | Argument:\n", " | distance -- a number (integer or float)\n", " | \n", " | Move the turtle forward by the specified distance, in the direction\n", " | the turtle is headed.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.forward(25)\n", " | >>> turtle.position()\n", " | (25.00,0.00)\n", " | >>> turtle.forward(-75)\n", " | >>> turtle.position()\n", " | (-50.00,0.00)\n", " | \n", " | forward(self, distance)\n", " | Move the turtle forward by the specified distance.\n", " | \n", " | Aliases: forward | fd\n", " | \n", " | Argument:\n", " | distance -- a number (integer or float)\n", " | \n", " | Move the turtle forward by the specified distance, in the direction\n", " | the turtle is headed.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.forward(25)\n", " | >>> turtle.position()\n", " | (25.00,0.00)\n", " | >>> turtle.forward(-75)\n", " | >>> turtle.position()\n", " | (-50.00,0.00)\n", " | \n", " | goto(self, x, y=None)\n", " | Move turtle to an absolute position.\n", " | \n", " | Aliases: setpos | setposition | goto:\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers\n", " | y -- a number None\n", " | \n", " | call: goto(x, y) # two coordinates\n", " | --or: goto((x, y)) # a pair (tuple) of coordinates\n", " | --or: goto(vec) # e.g. as returned by pos()\n", " | \n", " | Move turtle to an absolute position. If the pen is down,\n", " | a line will be drawn. The turtle's orientation does not change.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> tp = turtle.pos()\n", " | >>> tp\n", " | (0.00, 0.00)\n", " | >>> turtle.setpos(60,30)\n", " | >>> turtle.pos()\n", " | (60.00,30.00)\n", " | >>> turtle.setpos((20,80))\n", " | >>> turtle.pos()\n", " | (20.00,80.00)\n", " | >>> turtle.setpos(tp)\n", " | >>> turtle.pos()\n", " | (0.00,0.00)\n", " | \n", " | heading(self)\n", " | Return the turtle's current heading.\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.left(67)\n", " | >>> turtle.heading()\n", " | 67.0\n", " | \n", " | home(self)\n", " | Move turtle to the origin - coordinates (0,0).\n", " | \n", " | No arguments.\n", " | \n", " | Move turtle to the origin - coordinates (0,0) and set its\n", " | heading to its start-orientation (which depends on mode).\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.home()\n", " | \n", " | left(self, angle)\n", " | Turn turtle left by angle units.\n", " | \n", " | Aliases: left | lt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle left by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.left(45)\n", " | >>> turtle.heading()\n", " | 67.0\n", " | \n", " | lt = left(self, angle)\n", " | Turn turtle left by angle units.\n", " | \n", " | Aliases: left | lt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle left by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.left(45)\n", " | >>> turtle.heading()\n", " | 67.0\n", " | \n", " | pos(self)\n", " | Return the turtle's current location (x,y), as a Vec2D-vector.\n", " | \n", " | Aliases: pos | position\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (0.00, 240.00)\n", " | \n", " | position = pos(self)\n", " | Return the turtle's current location (x,y), as a Vec2D-vector.\n", " | \n", " | Aliases: pos | position\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (0.00, 240.00)\n", " | \n", " | radians(self)\n", " | Set the angle measurement units to radians.\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 90\n", " | >>> turtle.radians()\n", " | >>> turtle.heading()\n", " | 1.5707963267948966\n", " | \n", " | right(self, angle)\n", " | Turn turtle right by angle units.\n", " | \n", " | Aliases: right | rt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle right by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.right(45)\n", " | >>> turtle.heading()\n", " | 337.0\n", " | \n", " | rt = right(self, angle)\n", " | Turn turtle right by angle units.\n", " | \n", " | Aliases: right | rt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle right by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.right(45)\n", " | >>> turtle.heading()\n", " | 337.0\n", " | \n", " | seth = setheading(self, to_angle)\n", " | Set the orientation of the turtle to to_angle.\n", " | \n", " | Aliases: setheading | seth\n", " | \n", " | Argument:\n", " | to_angle -- a number (integer or float)\n", " | \n", " | Set the orientation of the turtle to to_angle.\n", " | Here are some common directions in degrees:\n", " | \n", " | standard - mode: logo-mode:\n", " | -------------------|--------------------\n", " | 0 - east 0 - north\n", " | 90 - north 90 - east\n", " | 180 - west 180 - south\n", " | 270 - south 270 - west\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.setheading(90)\n", " | >>> turtle.heading()\n", " | 90\n", " | \n", " | setheading(self, to_angle)\n", " | Set the orientation of the turtle to to_angle.\n", " | \n", " | Aliases: setheading | seth\n", " | \n", " | Argument:\n", " | to_angle -- a number (integer or float)\n", " | \n", " | Set the orientation of the turtle to to_angle.\n", " | Here are some common directions in degrees:\n", " | \n", " | standard - mode: logo-mode:\n", " | -------------------|--------------------\n", " | 0 - east 0 - north\n", " | 90 - north 90 - east\n", " | 180 - west 180 - south\n", " | 270 - south 270 - west\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.setheading(90)\n", " | >>> turtle.heading()\n", " | 90\n", " | \n", " | setpos = goto(self, x, y=None)\n", " | Move turtle to an absolute position.\n", " | \n", " | Aliases: setpos | setposition | goto:\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers\n", " | y -- a number None\n", " | \n", " | call: goto(x, y) # two coordinates\n", " | --or: goto((x, y)) # a pair (tuple) of coordinates\n", " | --or: goto(vec) # e.g. as returned by pos()\n", " | \n", " | Move turtle to an absolute position. If the pen is down,\n", " | a line will be drawn. The turtle's orientation does not change.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> tp = turtle.pos()\n", " | >>> tp\n", " | (0.00, 0.00)\n", " | >>> turtle.setpos(60,30)\n", " | >>> turtle.pos()\n", " | (60.00,30.00)\n", " | >>> turtle.setpos((20,80))\n", " | >>> turtle.pos()\n", " | (20.00,80.00)\n", " | >>> turtle.setpos(tp)\n", " | >>> turtle.pos()\n", " | (0.00,0.00)\n", " | \n", " | setposition = goto(self, x, y=None)\n", " | Move turtle to an absolute position.\n", " | \n", " | Aliases: setpos | setposition | goto:\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers\n", " | y -- a number None\n", " | \n", " | call: goto(x, y) # two coordinates\n", " | --or: goto((x, y)) # a pair (tuple) of coordinates\n", " | --or: goto(vec) # e.g. as returned by pos()\n", " | \n", " | Move turtle to an absolute position. If the pen is down,\n", " | a line will be drawn. The turtle's orientation does not change.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> tp = turtle.pos()\n", " | >>> tp\n", " | (0.00, 0.00)\n", " | >>> turtle.setpos(60,30)\n", " | >>> turtle.pos()\n", " | (60.00,30.00)\n", " | >>> turtle.setpos((20,80))\n", " | >>> turtle.pos()\n", " | (20.00,80.00)\n", " | >>> turtle.setpos(tp)\n", " | >>> turtle.pos()\n", " | (0.00,0.00)\n", " | \n", " | setx(self, x)\n", " | Set the turtle's first coordinate to x\n", " | \n", " | Argument:\n", " | x -- a number (integer or float)\n", " | \n", " | Set the turtle's first coordinate to x, leave second coordinate\n", " | unchanged.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 240.00)\n", " | >>> turtle.setx(10)\n", " | >>> turtle.position()\n", " | (10.00, 240.00)\n", " | \n", " | sety(self, y)\n", " | Set the turtle's second coordinate to y\n", " | \n", " | Argument:\n", " | y -- a number (integer or float)\n", " | \n", " | Set the turtle's first coordinate to x, second coordinate remains\n", " | unchanged.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 40.00)\n", " | >>> turtle.sety(-10)\n", " | >>> turtle.position()\n", " | (0.00, -10.00)\n", " | \n", " | towards(self, x, y=None)\n", " | Return the angle of the line from the turtle's position to (x, y).\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers or a turtle instance\n", " | y -- a number None None\n", " | \n", " | call: distance(x, y) # two coordinates\n", " | --or: distance((x, y)) # a pair (tuple) of coordinates\n", " | --or: distance(vec) # e.g. as returned by pos()\n", " | --or: distance(mypen) # where mypen is another turtle\n", " | \n", " | Return the angle, between the line from turtle-position to position\n", " | specified by x, y and the turtle's start orientation. (Depends on\n", " | modes - \"standard\" or \"logo\")\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (10.00, 10.00)\n", " | >>> turtle.towards(0,0)\n", " | 225.0\n", " | \n", " | xcor(self)\n", " | Return the turtle's x coordinate.\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> reset()\n", " | >>> turtle.left(60)\n", " | >>> turtle.forward(100)\n", " | >>> print turtle.xcor()\n", " | 50.0\n", " | \n", " | ycor(self)\n", " | Return the turtle's y coordinate\n", " | ---\n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> reset()\n", " | >>> turtle.left(60)\n", " | >>> turtle.forward(100)\n", " | >>> print turtle.ycor()\n", " | 86.6025403784\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data and other attributes inherited from TNavigator:\n", " | \n", " | DEFAULT_ANGLEOFFSET = 0\n", " | \n", " | DEFAULT_ANGLEORIENT = 1\n", " | \n", " | DEFAULT_MODE = 'standard'\n", " | \n", " | START_ORIENTATION = {'logo': (0.00,1.00), 'standard': (1.00,0.00), 'wo...\n", " \n", " class RawTurtle(TPen, TNavigator)\n", " | Animation part of the RawTurtle.\n", " | Puts RawTurtle upon a TurtleScreen and provides tools for\n", " | its animation.\n", " | \n", " | Method resolution order:\n", " | RawTurtle\n", " | TPen\n", " | TNavigator\n", " | builtins.object\n", " | \n", " | Methods defined here:\n", " | \n", " | __init__(self, canvas=None, shape='classic', undobuffersize=1000, visible=True)\n", " | Initialize self. See help(type(self)) for accurate signature.\n", " | \n", " | begin_fill(self)\n", " | Called just before drawing a shape to be filled.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"black\", \"red\")\n", " | >>> turtle.begin_fill()\n", " | >>> turtle.circle(60)\n", " | >>> turtle.end_fill()\n", " | \n", " | begin_poly(self)\n", " | Start recording the vertices of a polygon.\n", " | \n", " | No argument.\n", " | \n", " | Start recording the vertices of a polygon. Current turtle position\n", " | is first point of polygon.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.begin_poly()\n", " | \n", " | clear(self)\n", " | Delete the turtle's drawings from the screen. Do not move turtle.\n", " | \n", " | No arguments.\n", " | \n", " | Delete the turtle's drawings from the screen. Do not move turtle.\n", " | State and position of the turtle as well as drawings of other\n", " | turtles are not affected.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.clear()\n", " | \n", " | clearstamp(self, stampid)\n", " | Delete stamp with given stampid\n", " | \n", " | Argument:\n", " | stampid - an integer, must be return value of previous stamp() call.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"blue\")\n", " | >>> astamp = turtle.stamp()\n", " | >>> turtle.fd(50)\n", " | >>> turtle.clearstamp(astamp)\n", " | \n", " | clearstamps(self, n=None)\n", " | Delete all or first/last n of turtle's stamps.\n", " | \n", " | Optional argument:\n", " | n -- an integer\n", " | \n", " | If n is None, delete all of pen's stamps,\n", " | else if n > 0 delete first n stamps\n", " | else if n < 0 delete last n stamps.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> for i in range(8):\n", " | ... turtle.stamp(); turtle.fd(30)\n", " | ...\n", " | >>> turtle.clearstamps(2)\n", " | >>> turtle.clearstamps(-2)\n", " | >>> turtle.clearstamps()\n", " | \n", " | clone(self)\n", " | Create and return a clone of the turtle.\n", " | \n", " | No argument.\n", " | \n", " | Create and return a clone of the turtle with same position, heading\n", " | and turtle properties.\n", " | \n", " | Example (for a Turtle instance named mick):\n", " | mick = Turtle()\n", " | joe = mick.clone()\n", " | \n", " | dot(self, size=None, *color)\n", " | Draw a dot with diameter size, using color.\n", " | \n", " | Optional arguments:\n", " | size -- an integer >= 1 (if given)\n", " | color -- a colorstring or a numeric color tuple\n", " | \n", " | Draw a circular dot with diameter size, using color.\n", " | If size is not given, the maximum of pensize+4 and 2*pensize is used.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.dot()\n", " | >>> turtle.fd(50); turtle.dot(20, \"blue\"); turtle.fd(50)\n", " | \n", " | end_fill(self)\n", " | Fill the shape drawn after the call begin_fill().\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"black\", \"red\")\n", " | >>> turtle.begin_fill()\n", " | >>> turtle.circle(60)\n", " | >>> turtle.end_fill()\n", " | \n", " | end_poly(self)\n", " | Stop recording the vertices of a polygon.\n", " | \n", " | No argument.\n", " | \n", " | Stop recording the vertices of a polygon. Current turtle position is\n", " | last point of polygon. This will be connected with the first point.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.end_poly()\n", " | \n", " | filling(self)\n", " | Return fillstate (True if filling, False else).\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.begin_fill()\n", " | >>> if turtle.filling():\n", " | ... turtle.pensize(5)\n", " | ... else:\n", " | ... turtle.pensize(3)\n", " | \n", " | get_poly(self)\n", " | Return the lastly recorded polygon.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> p = turtle.get_poly()\n", " | >>> turtle.register_shape(\"myFavouriteShape\", p)\n", " | \n", " | get_shapepoly(self)\n", " | Return the current shape polygon as tuple of coordinate pairs.\n", " | \n", " | No argument.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"square\")\n", " | >>> turtle.shapetransform(4, -1, 0, 2)\n", " | >>> turtle.get_shapepoly()\n", " | ((50, -20), (30, 20), (-50, 20), (-30, -20))\n", " | \n", " | getpen = getturtle(self)\n", " | \n", " | getscreen(self)\n", " | Return the TurtleScreen object, the turtle is drawing on.\n", " | \n", " | No argument.\n", " | \n", " | Return the TurtleScreen object, the turtle is drawing on.\n", " | So TurtleScreen-methods can be called for that object.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> ts = turtle.getscreen()\n", " | >>> ts\n", " | \n", " | >>> ts.bgcolor(\"pink\")\n", " | \n", " | getturtle(self)\n", " | Return the Turtleobject itself.\n", " | \n", " | No argument.\n", " | \n", " | Only reasonable use: as a function to return the 'anonymous turtle':\n", " | \n", " | Example:\n", " | >>> pet = getturtle()\n", " | >>> pet.fd(50)\n", " | >>> pet\n", " | \n", " | >>> turtles()\n", " | []\n", " | \n", " | onclick(self, fun, btn=1, add=None)\n", " | Bind fun to mouse-click event on this turtle on canvas.\n", " | \n", " | Arguments:\n", " | fun -- a function with two arguments, to which will be assigned\n", " | the coordinates of the clicked point on the canvas.\n", " | num -- number of the mouse-button defaults to 1 (left mouse button).\n", " | add -- True or False. If True, new binding will be added, otherwise\n", " | it will replace a former binding.\n", " | \n", " | Example for the anonymous turtle, i. e. the procedural way:\n", " | \n", " | >>> def turn(x, y):\n", " | ... left(360)\n", " | ...\n", " | >>> onclick(turn) # Now clicking into the turtle will turn it.\n", " | >>> onclick(None) # event-binding will be removed\n", " | \n", " | ondrag(self, fun, btn=1, add=None)\n", " | Bind fun to mouse-move event on this turtle on canvas.\n", " | \n", " | Arguments:\n", " | fun -- a function with two arguments, to which will be assigned\n", " | the coordinates of the clicked point on the canvas.\n", " | num -- number of the mouse-button defaults to 1 (left mouse button).\n", " | \n", " | Every sequence of mouse-move-events on a turtle is preceded by a\n", " | mouse-click event on that turtle.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.ondrag(turtle.goto)\n", " | \n", " | Subsequently clicking and dragging a Turtle will move it\n", " | across the screen thereby producing handdrawings (if pen is\n", " | down).\n", " | \n", " | onrelease(self, fun, btn=1, add=None)\n", " | Bind fun to mouse-button-release event on this turtle on canvas.\n", " | \n", " | Arguments:\n", " | fun -- a function with two arguments, to which will be assigned\n", " | the coordinates of the clicked point on the canvas.\n", " | num -- number of the mouse-button defaults to 1 (left mouse button).\n", " | \n", " | Example (for a MyTurtle instance named joe):\n", " | >>> class MyTurtle(Turtle):\n", " | ... def glow(self,x,y):\n", " | ... self.fillcolor(\"red\")\n", " | ... def unglow(self,x,y):\n", " | ... self.fillcolor(\"\")\n", " | ...\n", " | >>> joe = MyTurtle()\n", " | >>> joe.onclick(joe.glow)\n", " | >>> joe.onrelease(joe.unglow)\n", " | \n", " | Clicking on joe turns fillcolor red, unclicking turns it to\n", " | transparent.\n", " | \n", " | reset(self)\n", " | Delete the turtle's drawings and restore its default values.\n", " | \n", " | No argument.\n", " | \n", " | Delete the turtle's drawings from the screen, re-center the turtle\n", " | and set variables to the default values.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00,-22.00)\n", " | >>> turtle.heading()\n", " | 100.0\n", " | >>> turtle.reset()\n", " | >>> turtle.position()\n", " | (0.00,0.00)\n", " | >>> turtle.heading()\n", " | 0.0\n", " | \n", " | settiltangle(self, angle)\n", " | Rotate the turtleshape to point in the specified direction\n", " | \n", " | Argument: angle -- number\n", " | \n", " | Rotate the turtleshape to point in the direction specified by angle,\n", " | regardless of its current tilt-angle. DO NOT change the turtle's\n", " | heading (direction of movement).\n", " | \n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.settiltangle(45)\n", " | >>> stamp()\n", " | >>> turtle.fd(50)\n", " | >>> turtle.settiltangle(-45)\n", " | >>> stamp()\n", " | >>> turtle.fd(50)\n", " | \n", " | setundobuffer(self, size)\n", " | Set or disable undobuffer.\n", " | \n", " | Argument:\n", " | size -- an integer or None\n", " | \n", " | If size is an integer an empty undobuffer of given size is installed.\n", " | Size gives the maximum number of turtle-actions that can be undone\n", " | by the undo() function.\n", " | If size is None, no undobuffer is present.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.setundobuffer(42)\n", " | \n", " | shape(self, name=None)\n", " | Set turtle shape to shape with given name / return current shapename.\n", " | \n", " | Optional argument:\n", " | name -- a string, which is a valid shapename\n", " | \n", " | Set turtle shape to shape with given name or, if name is not given,\n", " | return name of current shape.\n", " | Shape with name must exist in the TurtleScreen's shape dictionary.\n", " | Initially there are the following polygon shapes:\n", " | 'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'.\n", " | To learn about how to deal with shapes see Screen-method register_shape.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.shape()\n", " | 'arrow'\n", " | >>> turtle.shape(\"turtle\")\n", " | >>> turtle.shape()\n", " | 'turtle'\n", " | \n", " | shapesize(self, stretch_wid=None, stretch_len=None, outline=None)\n", " | Set/return turtle's stretchfactors/outline. Set resizemode to \"user\".\n", " | \n", " | Optional arguments:\n", " | stretch_wid : positive number\n", " | stretch_len : positive number\n", " | outline : positive number\n", " | \n", " | Return or set the pen's attributes x/y-stretchfactors and/or outline.\n", " | Set resizemode to \"user\".\n", " | If and only if resizemode is set to \"user\", the turtle will be displayed\n", " | stretched according to its stretchfactors:\n", " | stretch_wid is stretchfactor perpendicular to orientation\n", " | stretch_len is stretchfactor in direction of turtles orientation.\n", " | outline determines the width of the shapes's outline.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.resizemode(\"user\")\n", " | >>> turtle.shapesize(5, 5, 12)\n", " | >>> turtle.shapesize(outline=8)\n", " | \n", " | shapetransform(self, t11=None, t12=None, t21=None, t22=None)\n", " | Set or return the current transformation matrix of the turtle shape.\n", " | \n", " | Optional arguments: t11, t12, t21, t22 -- numbers.\n", " | \n", " | If none of the matrix elements are given, return the transformation\n", " | matrix.\n", " | Otherwise set the given elements and transform the turtleshape\n", " | according to the matrix consisting of first row t11, t12 and\n", " | second row t21, 22.\n", " | Modify stretchfactor, shearfactor and tiltangle according to the\n", " | given matrix.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"square\")\n", " | >>> turtle.shapesize(4,2)\n", " | >>> turtle.shearfactor(-0.5)\n", " | >>> turtle.shapetransform()\n", " | (4.0, -1.0, -0.0, 2.0)\n", " | \n", " | shearfactor(self, shear=None)\n", " | Set or return the current shearfactor.\n", " | \n", " | Optional argument: shear -- number, tangent of the shear angle\n", " | \n", " | Shear the turtleshape according to the given shearfactor shear,\n", " | which is the tangent of the shear angle. DO NOT change the\n", " | turtle's heading (direction of movement).\n", " | If shear is not given: return the current shearfactor, i. e. the\n", " | tangent of the shear angle, by which lines parallel to the\n", " | heading of the turtle are sheared.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.shearfactor(0.5)\n", " | >>> turtle.shearfactor()\n", " | >>> 0.5\n", " | \n", " | stamp(self)\n", " | Stamp a copy of the turtleshape onto the canvas and return its id.\n", " | \n", " | No argument.\n", " | \n", " | Stamp a copy of the turtle shape onto the canvas at the current\n", " | turtle position. Return a stamp_id for that stamp, which can be\n", " | used to delete it by calling clearstamp(stamp_id).\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"blue\")\n", " | >>> turtle.stamp()\n", " | 13\n", " | >>> turtle.fd(50)\n", " | \n", " | tilt(self, angle)\n", " | Rotate the turtleshape by angle.\n", " | \n", " | Argument:\n", " | angle - a number\n", " | \n", " | Rotate the turtleshape by angle from its current tilt-angle,\n", " | but do NOT change the turtle's heading (direction of movement).\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.tilt(30)\n", " | >>> turtle.fd(50)\n", " | >>> turtle.tilt(30)\n", " | >>> turtle.fd(50)\n", " | \n", " | tiltangle(self, angle=None)\n", " | Set or return the current tilt-angle.\n", " | \n", " | Optional argument: angle -- number\n", " | \n", " | Rotate the turtleshape to point in the direction specified by angle,\n", " | regardless of its current tilt-angle. DO NOT change the turtle's\n", " | heading (direction of movement).\n", " | If angle is not given: return the current tilt-angle, i. e. the angle\n", " | between the orientation of the turtleshape and the heading of the\n", " | turtle (its direction of movement).\n", " | \n", " | Deprecated since Python 3.1\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.tilt(45)\n", " | >>> turtle.tiltangle()\n", " | \n", " | turtlesize = shapesize(self, stretch_wid=None, stretch_len=None, outline=None)\n", " | \n", " | undo(self)\n", " | undo (repeatedly) the last turtle action.\n", " | \n", " | No argument.\n", " | \n", " | undo (repeatedly) the last turtle action.\n", " | Number of available undo actions is determined by the size of\n", " | the undobuffer.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> for i in range(4):\n", " | ... turtle.fd(50); turtle.lt(80)\n", " | ...\n", " | >>> for i in range(8):\n", " | ... turtle.undo()\n", " | ...\n", " | \n", " | undobufferentries(self)\n", " | Return count of entries in the undobuffer.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> while undobufferentries():\n", " | ... undo()\n", " | \n", " | write(self, arg, move=False, align='left', font=('Arial', 8, 'normal'))\n", " | Write text at the current turtle position.\n", " | \n", " | Arguments:\n", " | arg -- info, which is to be written to the TurtleScreen\n", " | move (optional) -- True/False\n", " | align (optional) -- one of the strings \"left\", \"center\" or right\"\n", " | font (optional) -- a triple (fontname, fontsize, fonttype)\n", " | \n", " | Write text - the string representation of arg - at the current\n", " | turtle position according to align (\"left\", \"center\" or right\")\n", " | and with the given font.\n", " | If move is True, the pen is moved to the bottom-right corner\n", " | of the text. By default, move is False.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.write('Home = ', True, align=\"center\")\n", " | >>> turtle.write((0,0), True)\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data and other attributes defined here:\n", " | \n", " | screens = []\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from TPen:\n", " | \n", " | color(self, *args)\n", " | Return or set the pencolor and fillcolor.\n", " | \n", " | Arguments:\n", " | Several input formats are allowed.\n", " | They use 0, 1, 2, or 3 arguments as follows:\n", " | \n", " | color()\n", " | Return the current pencolor and the current fillcolor\n", " | as a pair of color specification strings as are returned\n", " | by pencolor and fillcolor.\n", " | color(colorstring), color((r,g,b)), color(r,g,b)\n", " | inputs as in pencolor, set both, fillcolor and pencolor,\n", " | to the given value.\n", " | color(colorstring1, colorstring2),\n", " | color((r1,g1,b1), (r2,g2,b2))\n", " | equivalent to pencolor(colorstring1) and fillcolor(colorstring2)\n", " | and analogously, if the other input format is used.\n", " | \n", " | If turtleshape is a polygon, outline and interior of that polygon\n", " | is drawn with the newly set colors.\n", " | For mor info see: pencolor, fillcolor\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color('red', 'green')\n", " | >>> turtle.color()\n", " | ('red', 'green')\n", " | >>> colormode(255)\n", " | >>> color((40, 80, 120), (160, 200, 240))\n", " | >>> color()\n", " | ('#285078', '#a0c8f0')\n", " | \n", " | down = pendown(self)\n", " | Pull the pen down -- drawing when moving.\n", " | \n", " | Aliases: pendown | pd | down\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pendown()\n", " | \n", " | fillcolor(self, *args)\n", " | Return or set the fillcolor.\n", " | \n", " | Arguments:\n", " | Four input formats are allowed:\n", " | - fillcolor()\n", " | Return the current fillcolor as color specification string,\n", " | possibly in hex-number format (see example).\n", " | May be used as input to another color/pencolor/fillcolor call.\n", " | - fillcolor(colorstring)\n", " | s is a Tk color specification string, such as \"red\" or \"yellow\"\n", " | - fillcolor((r, g, b))\n", " | *a tuple* of r, g, and b, which represent, an RGB color,\n", " | and each of r, g, and b are in the range 0..colormode,\n", " | where colormode is either 1.0 or 255\n", " | - fillcolor(r, g, b)\n", " | r, g, and b represent an RGB color, and each of r, g, and b\n", " | are in the range 0..colormode\n", " | \n", " | If turtleshape is a polygon, the interior of that polygon is drawn\n", " | with the newly set fillcolor.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.fillcolor('violet')\n", " | >>> col = turtle.pencolor()\n", " | >>> turtle.fillcolor(col)\n", " | >>> turtle.fillcolor(0, .5, 0)\n", " | \n", " | hideturtle(self)\n", " | Makes the turtle invisible.\n", " | \n", " | Aliases: hideturtle | ht\n", " | \n", " | No argument.\n", " | \n", " | It's a good idea to do this while you're in the\n", " | middle of a complicated drawing, because hiding\n", " | the turtle speeds up the drawing observably.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | \n", " | ht = hideturtle(self)\n", " | Makes the turtle invisible.\n", " | \n", " | Aliases: hideturtle | ht\n", " | \n", " | No argument.\n", " | \n", " | It's a good idea to do this while you're in the\n", " | middle of a complicated drawing, because hiding\n", " | the turtle speeds up the drawing observably.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | \n", " | isdown(self)\n", " | Return True if pen is down, False if it's up.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | >>> turtle.isdown()\n", " | False\n", " | >>> turtle.pendown()\n", " | >>> turtle.isdown()\n", " | True\n", " | \n", " | isvisible(self)\n", " | Return True if the Turtle is shown, False if it's hidden.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | >>> print turtle.isvisible():\n", " | False\n", " | \n", " | pd = pendown(self)\n", " | Pull the pen down -- drawing when moving.\n", " | \n", " | Aliases: pendown | pd | down\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pendown()\n", " | \n", " | pen(self, pen=None, **pendict)\n", " | Return or set the pen's attributes.\n", " | \n", " | Arguments:\n", " | pen -- a dictionary with some or all of the below listed keys.\n", " | **pendict -- one or more keyword-arguments with the below\n", " | listed keys as keywords.\n", " | \n", " | Return or set the pen's attributes in a 'pen-dictionary'\n", " | with the following key/value pairs:\n", " | \"shown\" : True/False\n", " | \"pendown\" : True/False\n", " | \"pencolor\" : color-string or color-tuple\n", " | \"fillcolor\" : color-string or color-tuple\n", " | \"pensize\" : positive number\n", " | \"speed\" : number in range 0..10\n", " | \"resizemode\" : \"auto\" or \"user\" or \"noresize\"\n", " | \"stretchfactor\": (positive number, positive number)\n", " | \"shearfactor\": number\n", " | \"outline\" : positive number\n", " | \"tilt\" : number\n", " | \n", " | This dictionary can be used as argument for a subsequent\n", " | pen()-call to restore the former pen-state. Moreover one\n", " | or more of these attributes can be provided as keyword-arguments.\n", " | This can be used to set several pen attributes in one statement.\n", " | \n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n", " | >>> turtle.pen()\n", " | {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " | 'pencolor': 'red', 'pendown': True, 'fillcolor': 'black',\n", " | 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " | >>> penstate=turtle.pen()\n", " | >>> turtle.color(\"yellow\",\"\")\n", " | >>> turtle.penup()\n", " | >>> turtle.pen()\n", " | {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " | 'pencolor': 'yellow', 'pendown': False, 'fillcolor': '',\n", " | 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " | >>> p.pen(penstate, fillcolor=\"green\")\n", " | >>> p.pen()\n", " | {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " | 'pencolor': 'red', 'pendown': True, 'fillcolor': 'green',\n", " | 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " | \n", " | pencolor(self, *args)\n", " | Return or set the pencolor.\n", " | \n", " | Arguments:\n", " | Four input formats are allowed:\n", " | - pencolor()\n", " | Return the current pencolor as color specification string,\n", " | possibly in hex-number format (see example).\n", " | May be used as input to another color/pencolor/fillcolor call.\n", " | - pencolor(colorstring)\n", " | s is a Tk color specification string, such as \"red\" or \"yellow\"\n", " | - pencolor((r, g, b))\n", " | *a tuple* of r, g, and b, which represent, an RGB color,\n", " | and each of r, g, and b are in the range 0..colormode,\n", " | where colormode is either 1.0 or 255\n", " | - pencolor(r, g, b)\n", " | r, g, and b represent an RGB color, and each of r, g, and b\n", " | are in the range 0..colormode\n", " | \n", " | If turtleshape is a polygon, the outline of that polygon is drawn\n", " | with the newly set pencolor.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pencolor('brown')\n", " | >>> tup = (0.2, 0.8, 0.55)\n", " | >>> turtle.pencolor(tup)\n", " | >>> turtle.pencolor()\n", " | '#33cc8c'\n", " | \n", " | pendown(self)\n", " | Pull the pen down -- drawing when moving.\n", " | \n", " | Aliases: pendown | pd | down\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pendown()\n", " | \n", " | pensize(self, width=None)\n", " | Set or return the line thickness.\n", " | \n", " | Aliases: pensize | width\n", " | \n", " | Argument:\n", " | width -- positive number\n", " | \n", " | Set the line thickness to width or return it. If resizemode is set\n", " | to \"auto\" and turtleshape is a polygon, that polygon is drawn with\n", " | the same line thickness. If no argument is given, current pensize\n", " | is returned.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pensize()\n", " | 1\n", " | >>> turtle.pensize(10) # from here on lines of width 10 are drawn\n", " | \n", " | penup(self)\n", " | Pull the pen up -- no drawing when moving.\n", " | \n", " | Aliases: penup | pu | up\n", " | \n", " | No argument\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | \n", " | pu = penup(self)\n", " | Pull the pen up -- no drawing when moving.\n", " | \n", " | Aliases: penup | pu | up\n", " | \n", " | No argument\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | \n", " | resizemode(self, rmode=None)\n", " | Set resizemode to one of the values: \"auto\", \"user\", \"noresize\".\n", " | \n", " | (Optional) Argument:\n", " | rmode -- one of the strings \"auto\", \"user\", \"noresize\"\n", " | \n", " | Different resizemodes have the following effects:\n", " | - \"auto\" adapts the appearance of the turtle\n", " | corresponding to the value of pensize.\n", " | - \"user\" adapts the appearance of the turtle according to the\n", " | values of stretchfactor and outlinewidth (outline),\n", " | which are set by shapesize()\n", " | - \"noresize\" no adaption of the turtle's appearance takes place.\n", " | If no argument is given, return current resizemode.\n", " | resizemode(\"user\") is called by a call of shapesize with arguments.\n", " | \n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.resizemode(\"noresize\")\n", " | >>> turtle.resizemode()\n", " | 'noresize'\n", " | \n", " | showturtle(self)\n", " | Makes the turtle visible.\n", " | \n", " | Aliases: showturtle | st\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | >>> turtle.showturtle()\n", " | \n", " | speed(self, speed=None)\n", " | Return or set the turtle's speed.\n", " | \n", " | Optional argument:\n", " | speed -- an integer in the range 0..10 or a speedstring (see below)\n", " | \n", " | Set the turtle's speed to an integer value in the range 0 .. 10.\n", " | If no argument is given: return current speed.\n", " | \n", " | If input is a number greater than 10 or smaller than 0.5,\n", " | speed is set to 0.\n", " | Speedstrings are mapped to speedvalues in the following way:\n", " | 'fastest' : 0\n", " | 'fast' : 10\n", " | 'normal' : 6\n", " | 'slow' : 3\n", " | 'slowest' : 1\n", " | speeds from 1 to 10 enforce increasingly faster animation of\n", " | line drawing and turtle turning.\n", " | \n", " | Attention:\n", " | speed = 0 : *no* animation takes place. forward/back makes turtle jump\n", " | and likewise left/right make the turtle turn instantly.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.speed(3)\n", " | \n", " | st = showturtle(self)\n", " | Makes the turtle visible.\n", " | \n", " | Aliases: showturtle | st\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | >>> turtle.showturtle()\n", " | \n", " | up = penup(self)\n", " | Pull the pen up -- no drawing when moving.\n", " | \n", " | Aliases: penup | pu | up\n", " | \n", " | No argument\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | \n", " | width = pensize(self, width=None)\n", " | Set or return the line thickness.\n", " | \n", " | Aliases: pensize | width\n", " | \n", " | Argument:\n", " | width -- positive number\n", " | \n", " | Set the line thickness to width or return it. If resizemode is set\n", " | to \"auto\" and turtleshape is a polygon, that polygon is drawn with\n", " | the same line thickness. If no argument is given, current pensize\n", " | is returned.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pensize()\n", " | 1\n", " | >>> turtle.pensize(10) # from here on lines of width 10 are drawn\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data descriptors inherited from TPen:\n", " | \n", " | __dict__\n", " | dictionary for instance variables (if defined)\n", " | \n", " | __weakref__\n", " | list of weak references to the object (if defined)\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from TNavigator:\n", " | \n", " | back(self, distance)\n", " | Move the turtle backward by distance.\n", " | \n", " | Aliases: back | backward | bk\n", " | \n", " | Argument:\n", " | distance -- a number\n", " | \n", " | Move the turtle backward by distance ,opposite to the direction the\n", " | turtle is headed. Do not change the turtle's heading.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.backward(30)\n", " | >>> turtle.position()\n", " | (-30.00, 0.00)\n", " | \n", " | backward = back(self, distance)\n", " | Move the turtle backward by distance.\n", " | \n", " | Aliases: back | backward | bk\n", " | \n", " | Argument:\n", " | distance -- a number\n", " | \n", " | Move the turtle backward by distance ,opposite to the direction the\n", " | turtle is headed. Do not change the turtle's heading.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.backward(30)\n", " | >>> turtle.position()\n", " | (-30.00, 0.00)\n", " | \n", " | bk = back(self, distance)\n", " | Move the turtle backward by distance.\n", " | \n", " | Aliases: back | backward | bk\n", " | \n", " | Argument:\n", " | distance -- a number\n", " | \n", " | Move the turtle backward by distance ,opposite to the direction the\n", " | turtle is headed. Do not change the turtle's heading.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.backward(30)\n", " | >>> turtle.position()\n", " | (-30.00, 0.00)\n", " | \n", " | circle(self, radius, extent=None, steps=None)\n", " | Draw a circle with given radius.\n", " | \n", " | Arguments:\n", " | radius -- a number\n", " | extent (optional) -- a number\n", " | steps (optional) -- an integer\n", " | \n", " | Draw a circle with given radius. The center is radius units left\n", " | of the turtle; extent - an angle - determines which part of the\n", " | circle is drawn. If extent is not given, draw the entire circle.\n", " | If extent is not a full circle, one endpoint of the arc is the\n", " | current pen position. Draw the arc in counterclockwise direction\n", " | if radius is positive, otherwise in clockwise direction. Finally\n", " | the direction of the turtle is changed by the amount of extent.\n", " | \n", " | As the circle is approximated by an inscribed regular polygon,\n", " | steps determines the number of steps to use. If not given,\n", " | it will be calculated automatically. Maybe used to draw regular\n", " | polygons.\n", " | \n", " | call: circle(radius) # full circle\n", " | --or: circle(radius, extent) # arc\n", " | --or: circle(radius, extent, steps)\n", " | --or: circle(radius, steps=6) # 6-sided polygon\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.circle(50)\n", " | >>> turtle.circle(120, 180) # semicircle\n", " | \n", " | degrees(self, fullcircle=360.0)\n", " | Set angle measurement units to degrees.\n", " | \n", " | Optional argument:\n", " | fullcircle - a number\n", " | \n", " | Set angle measurement units, i. e. set number\n", " | of 'degrees' for a full circle. Dafault value is\n", " | 360 degrees.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.left(90)\n", " | >>> turtle.heading()\n", " | 90\n", " | \n", " | Change angle measurement unit to grad (also known as gon,\n", " | grade, or gradian and equals 1/100-th of the right angle.)\n", " | >>> turtle.degrees(400.0)\n", " | >>> turtle.heading()\n", " | 100\n", " | \n", " | distance(self, x, y=None)\n", " | Return the distance from the turtle to (x,y) in turtle step units.\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers or a turtle instance\n", " | y -- a number None None\n", " | \n", " | call: distance(x, y) # two coordinates\n", " | --or: distance((x, y)) # a pair (tuple) of coordinates\n", " | --or: distance(vec) # e.g. as returned by pos()\n", " | --or: distance(mypen) # where mypen is another turtle\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (0.00, 0.00)\n", " | >>> turtle.distance(30,40)\n", " | 50.0\n", " | >>> pen = Turtle()\n", " | >>> pen.forward(77)\n", " | >>> turtle.distance(pen)\n", " | 77.0\n", " | \n", " | fd = forward(self, distance)\n", " | Move the turtle forward by the specified distance.\n", " | \n", " | Aliases: forward | fd\n", " | \n", " | Argument:\n", " | distance -- a number (integer or float)\n", " | \n", " | Move the turtle forward by the specified distance, in the direction\n", " | the turtle is headed.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.forward(25)\n", " | >>> turtle.position()\n", " | (25.00,0.00)\n", " | >>> turtle.forward(-75)\n", " | >>> turtle.position()\n", " | (-50.00,0.00)\n", " | \n", " | forward(self, distance)\n", " | Move the turtle forward by the specified distance.\n", " | \n", " | Aliases: forward | fd\n", " | \n", " | Argument:\n", " | distance -- a number (integer or float)\n", " | \n", " | Move the turtle forward by the specified distance, in the direction\n", " | the turtle is headed.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.forward(25)\n", " | >>> turtle.position()\n", " | (25.00,0.00)\n", " | >>> turtle.forward(-75)\n", " | >>> turtle.position()\n", " | (-50.00,0.00)\n", " | \n", " | goto(self, x, y=None)\n", " | Move turtle to an absolute position.\n", " | \n", " | Aliases: setpos | setposition | goto:\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers\n", " | y -- a number None\n", " | \n", " | call: goto(x, y) # two coordinates\n", " | --or: goto((x, y)) # a pair (tuple) of coordinates\n", " | --or: goto(vec) # e.g. as returned by pos()\n", " | \n", " | Move turtle to an absolute position. If the pen is down,\n", " | a line will be drawn. The turtle's orientation does not change.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> tp = turtle.pos()\n", " | >>> tp\n", " | (0.00, 0.00)\n", " | >>> turtle.setpos(60,30)\n", " | >>> turtle.pos()\n", " | (60.00,30.00)\n", " | >>> turtle.setpos((20,80))\n", " | >>> turtle.pos()\n", " | (20.00,80.00)\n", " | >>> turtle.setpos(tp)\n", " | >>> turtle.pos()\n", " | (0.00,0.00)\n", " | \n", " | heading(self)\n", " | Return the turtle's current heading.\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.left(67)\n", " | >>> turtle.heading()\n", " | 67.0\n", " | \n", " | home(self)\n", " | Move turtle to the origin - coordinates (0,0).\n", " | \n", " | No arguments.\n", " | \n", " | Move turtle to the origin - coordinates (0,0) and set its\n", " | heading to its start-orientation (which depends on mode).\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.home()\n", " | \n", " | left(self, angle)\n", " | Turn turtle left by angle units.\n", " | \n", " | Aliases: left | lt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle left by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.left(45)\n", " | >>> turtle.heading()\n", " | 67.0\n", " | \n", " | lt = left(self, angle)\n", " | Turn turtle left by angle units.\n", " | \n", " | Aliases: left | lt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle left by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.left(45)\n", " | >>> turtle.heading()\n", " | 67.0\n", " | \n", " | pos(self)\n", " | Return the turtle's current location (x,y), as a Vec2D-vector.\n", " | \n", " | Aliases: pos | position\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (0.00, 240.00)\n", " | \n", " | position = pos(self)\n", " | Return the turtle's current location (x,y), as a Vec2D-vector.\n", " | \n", " | Aliases: pos | position\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (0.00, 240.00)\n", " | \n", " | radians(self)\n", " | Set the angle measurement units to radians.\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 90\n", " | >>> turtle.radians()\n", " | >>> turtle.heading()\n", " | 1.5707963267948966\n", " | \n", " | right(self, angle)\n", " | Turn turtle right by angle units.\n", " | \n", " | Aliases: right | rt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle right by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.right(45)\n", " | >>> turtle.heading()\n", " | 337.0\n", " | \n", " | rt = right(self, angle)\n", " | Turn turtle right by angle units.\n", " | \n", " | Aliases: right | rt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle right by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.right(45)\n", " | >>> turtle.heading()\n", " | 337.0\n", " | \n", " | seth = setheading(self, to_angle)\n", " | Set the orientation of the turtle to to_angle.\n", " | \n", " | Aliases: setheading | seth\n", " | \n", " | Argument:\n", " | to_angle -- a number (integer or float)\n", " | \n", " | Set the orientation of the turtle to to_angle.\n", " | Here are some common directions in degrees:\n", " | \n", " | standard - mode: logo-mode:\n", " | -------------------|--------------------\n", " | 0 - east 0 - north\n", " | 90 - north 90 - east\n", " | 180 - west 180 - south\n", " | 270 - south 270 - west\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.setheading(90)\n", " | >>> turtle.heading()\n", " | 90\n", " | \n", " | setheading(self, to_angle)\n", " | Set the orientation of the turtle to to_angle.\n", " | \n", " | Aliases: setheading | seth\n", " | \n", " | Argument:\n", " | to_angle -- a number (integer or float)\n", " | \n", " | Set the orientation of the turtle to to_angle.\n", " | Here are some common directions in degrees:\n", " | \n", " | standard - mode: logo-mode:\n", " | -------------------|--------------------\n", " | 0 - east 0 - north\n", " | 90 - north 90 - east\n", " | 180 - west 180 - south\n", " | 270 - south 270 - west\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.setheading(90)\n", " | >>> turtle.heading()\n", " | 90\n", " | \n", " | setpos = goto(self, x, y=None)\n", " | Move turtle to an absolute position.\n", " | \n", " | Aliases: setpos | setposition | goto:\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers\n", " | y -- a number None\n", " | \n", " | call: goto(x, y) # two coordinates\n", " | --or: goto((x, y)) # a pair (tuple) of coordinates\n", " | --or: goto(vec) # e.g. as returned by pos()\n", " | \n", " | Move turtle to an absolute position. If the pen is down,\n", " | a line will be drawn. The turtle's orientation does not change.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> tp = turtle.pos()\n", " | >>> tp\n", " | (0.00, 0.00)\n", " | >>> turtle.setpos(60,30)\n", " | >>> turtle.pos()\n", " | (60.00,30.00)\n", " | >>> turtle.setpos((20,80))\n", " | >>> turtle.pos()\n", " | (20.00,80.00)\n", " | >>> turtle.setpos(tp)\n", " | >>> turtle.pos()\n", " | (0.00,0.00)\n", " | \n", " | setposition = goto(self, x, y=None)\n", " | Move turtle to an absolute position.\n", " | \n", " | Aliases: setpos | setposition | goto:\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers\n", " | y -- a number None\n", " | \n", " | call: goto(x, y) # two coordinates\n", " | --or: goto((x, y)) # a pair (tuple) of coordinates\n", " | --or: goto(vec) # e.g. as returned by pos()\n", " | \n", " | Move turtle to an absolute position. If the pen is down,\n", " | a line will be drawn. The turtle's orientation does not change.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> tp = turtle.pos()\n", " | >>> tp\n", " | (0.00, 0.00)\n", " | >>> turtle.setpos(60,30)\n", " | >>> turtle.pos()\n", " | (60.00,30.00)\n", " | >>> turtle.setpos((20,80))\n", " | >>> turtle.pos()\n", " | (20.00,80.00)\n", " | >>> turtle.setpos(tp)\n", " | >>> turtle.pos()\n", " | (0.00,0.00)\n", " | \n", " | setx(self, x)\n", " | Set the turtle's first coordinate to x\n", " | \n", " | Argument:\n", " | x -- a number (integer or float)\n", " | \n", " | Set the turtle's first coordinate to x, leave second coordinate\n", " | unchanged.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 240.00)\n", " | >>> turtle.setx(10)\n", " | >>> turtle.position()\n", " | (10.00, 240.00)\n", " | \n", " | sety(self, y)\n", " | Set the turtle's second coordinate to y\n", " | \n", " | Argument:\n", " | y -- a number (integer or float)\n", " | \n", " | Set the turtle's first coordinate to x, second coordinate remains\n", " | unchanged.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 40.00)\n", " | >>> turtle.sety(-10)\n", " | >>> turtle.position()\n", " | (0.00, -10.00)\n", " | \n", " | towards(self, x, y=None)\n", " | Return the angle of the line from the turtle's position to (x, y).\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers or a turtle instance\n", " | y -- a number None None\n", " | \n", " | call: distance(x, y) # two coordinates\n", " | --or: distance((x, y)) # a pair (tuple) of coordinates\n", " | --or: distance(vec) # e.g. as returned by pos()\n", " | --or: distance(mypen) # where mypen is another turtle\n", " | \n", " | Return the angle, between the line from turtle-position to position\n", " | specified by x, y and the turtle's start orientation. (Depends on\n", " | modes - \"standard\" or \"logo\")\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (10.00, 10.00)\n", " | >>> turtle.towards(0,0)\n", " | 225.0\n", " | \n", " | xcor(self)\n", " | Return the turtle's x coordinate.\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> reset()\n", " | >>> turtle.left(60)\n", " | >>> turtle.forward(100)\n", " | >>> print turtle.xcor()\n", " | 50.0\n", " | \n", " | ycor(self)\n", " | Return the turtle's y coordinate\n", " | ---\n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> reset()\n", " | >>> turtle.left(60)\n", " | >>> turtle.forward(100)\n", " | >>> print turtle.ycor()\n", " | 86.6025403784\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data and other attributes inherited from TNavigator:\n", " | \n", " | DEFAULT_ANGLEOFFSET = 0\n", " | \n", " | DEFAULT_ANGLEORIENT = 1\n", " | \n", " | DEFAULT_MODE = 'standard'\n", " | \n", " | START_ORIENTATION = {'logo': (0.00,1.00), 'standard': (1.00,0.00), 'wo...\n", " \n", " class ScrolledCanvas(tkinter.Frame)\n", " | Modeled after the scrolled canvas class from Grayons's Tkinter book.\n", " | \n", " | Used as the default canvas, which pops up automatically when\n", " | using turtle graphics functions or the Turtle class.\n", " | \n", " | Method resolution order:\n", " | ScrolledCanvas\n", " | tkinter.Frame\n", " | tkinter.Widget\n", " | tkinter.BaseWidget\n", " | tkinter.Misc\n", " | tkinter.Pack\n", " | tkinter.Place\n", " | tkinter.Grid\n", " | builtins.object\n", " | \n", " | Methods defined here:\n", " | \n", " | __init__(self, master, width=500, height=350, canvwidth=600, canvheight=500)\n", " | Construct a frame widget with the parent MASTER.\n", " | \n", " | Valid resource names: background, bd, bg, borderwidth, class,\n", " | colormap, container, cursor, height, highlightbackground,\n", " | highlightcolor, highlightthickness, relief, takefocus, visual, width.\n", " | \n", " | addtag(self, *args, **kw)\n", " | \n", " | addtag_above(self, *args, **kw)\n", " | \n", " | addtag_all(self, *args, **kw)\n", " | \n", " | addtag_below(self, *args, **kw)\n", " | \n", " | addtag_closest(self, *args, **kw)\n", " | \n", " | addtag_enclosed(self, *args, **kw)\n", " | \n", " | addtag_overlapping(self, *args, **kw)\n", " | \n", " | addtag_withtag(self, *args, **kw)\n", " | \n", " | adjustScrolls(self)\n", " | Adjust scrollbars according to window- and canvas-size.\n", " | \n", " | bbox(self, *args)\n", " | 'forward' method, which canvas itself has inherited...\n", " | \n", " | bind(self, *args, **kwargs)\n", " | 'forward' method, which canvas itself has inherited...\n", " | \n", " | canvasx(self, *args, **kw)\n", " | \n", " | canvasy(self, *args, **kw)\n", " | \n", " | cget(self, *args, **kwargs)\n", " | 'forward' method, which canvas itself has inherited...\n", " | \n", " | config(self, *args, **kwargs)\n", " | 'forward' method, which canvas itself has inherited...\n", " | \n", " | coords(self, *args, **kw)\n", " | \n", " | create_arc(self, *args, **kw)\n", " | \n", " | create_bitmap(self, *args, **kw)\n", " | \n", " | create_image(self, *args, **kw)\n", " | \n", " | create_line(self, *args, **kw)\n", " | \n", " | create_oval(self, *args, **kw)\n", " | \n", " | create_polygon(self, *args, **kw)\n", " | \n", " | create_rectangle(self, *args, **kw)\n", " | \n", " | create_text(self, *args, **kw)\n", " | \n", " | create_window(self, *args, **kw)\n", " | \n", " | dchars(self, *args, **kw)\n", " | \n", " | delete(self, *args, **kw)\n", " | \n", " | dtag(self, *args, **kw)\n", " | \n", " | find(self, *args, **kw)\n", " | \n", " | find_above(self, *args, **kw)\n", " | \n", " | find_all(self, *args, **kw)\n", " | \n", " | find_below(self, *args, **kw)\n", " | \n", " | find_closest(self, *args, **kw)\n", " | \n", " | find_enclosed(self, *args, **kw)\n", " | \n", " | find_overlapping(self, *args, **kw)\n", " | \n", " | find_withtag(self, *args, **kw)\n", " | \n", " | focus_force(self)\n", " | 'forward' method, which canvas itself has inherited...\n", " | \n", " | gettags(self, *args, **kw)\n", " | \n", " | icursor(self, *args, **kw)\n", " | \n", " | index(self, *args, **kw)\n", " | \n", " | insert(self, *args, **kw)\n", " | \n", " | itemcget(self, *args, **kw)\n", " | \n", " | itemconfig(self, *args, **kw)\n", " | \n", " | itemconfigure(self, *args, **kw)\n", " | \n", " | move(self, *args, **kw)\n", " | \n", " | onResize(self, event)\n", " | self-explanatory\n", " | \n", " | postscript(self, *args, **kw)\n", " | \n", " | reset(self, canvwidth=None, canvheight=None, bg=None)\n", " | Adjust canvas and scrollbars according to given canvas size.\n", " | \n", " | scale(self, *args, **kw)\n", " | \n", " | scan_dragto(self, *args, **kw)\n", " | \n", " | scan_mark(self, *args, **kw)\n", " | \n", " | select_adjust(self, *args, **kw)\n", " | \n", " | select_clear(self, *args, **kw)\n", " | \n", " | select_from(self, *args, **kw)\n", " | \n", " | select_item(self, *args, **kw)\n", " | \n", " | select_to(self, *args, **kw)\n", " | \n", " | tag_bind(self, *args, **kw)\n", " | \n", " | tag_lower(self, *args, **kw)\n", " | \n", " | tag_raise(self, *args, **kw)\n", " | \n", " | tag_unbind(self, *args, **kw)\n", " | \n", " | type(self, *args, **kw)\n", " | \n", " | unbind(self, *args, **kwargs)\n", " | 'forward' method, which canvas itself has inherited...\n", " | \n", " | xview(self, *args, **kw)\n", " | \n", " | xview_moveto(self, *args, **kw)\n", " | \n", " | xview_scroll(self, *args, **kw)\n", " | \n", " | yview(self, *args, **kw)\n", " | \n", " | yview_moveto(self, *args, **kw)\n", " | \n", " | yview_scroll(self, *args, **kw)\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from tkinter.BaseWidget:\n", " | \n", " | destroy(self)\n", " | Destroy this and all descendants widgets.\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from tkinter.Misc:\n", " | \n", " | __getitem__ = cget(self, key)\n", " | Return the resource value for a KEY given as string.\n", " | \n", " | __repr__(self)\n", " | Return repr(self).\n", " | \n", " | __setitem__(self, key, value)\n", " | \n", " | __str__(self)\n", " | Return the window path name of this widget.\n", " | \n", " | after(self, ms, func=None, *args)\n", " | Call function once after given time.\n", " | \n", " | MS specifies the time in milliseconds. FUNC gives the\n", " | function which shall be called. Additional parameters\n", " | are given as parameters to the function call. Return\n", " | identifier to cancel scheduling with after_cancel.\n", " | \n", " | after_cancel(self, id)\n", " | Cancel scheduling of function identified with ID.\n", " | \n", " | Identifier returned by after or after_idle must be\n", " | given as first parameter.\n", " | \n", " | after_idle(self, func, *args)\n", " | Call FUNC once if the Tcl main loop has no event to\n", " | process.\n", " | \n", " | Return an identifier to cancel the scheduling with\n", " | after_cancel.\n", " | \n", " | anchor = grid_anchor(self, anchor=None)\n", " | The anchor value controls how to place the grid within the\n", " | master when no row/column has any weight.\n", " | \n", " | The default anchor is nw.\n", " | \n", " | bell(self, displayof=0)\n", " | Ring a display's bell.\n", " | \n", " | bind_all(self, sequence=None, func=None, add=None)\n", " | Bind to all widgets at an event SEQUENCE a call to function FUNC.\n", " | An additional boolean parameter ADD specifies whether FUNC will\n", " | be called additionally to the other bound function or whether\n", " | it will replace the previous function. See bind for the return value.\n", " | \n", " | bind_class(self, className, sequence=None, func=None, add=None)\n", " | Bind to widgets with bindtag CLASSNAME at event\n", " | SEQUENCE a call of function FUNC. An additional\n", " | boolean parameter ADD specifies whether FUNC will be\n", " | called additionally to the other bound function or\n", " | whether it will replace the previous function. See bind for\n", " | the return value.\n", " | \n", " | bindtags(self, tagList=None)\n", " | Set or get the list of bindtags for this widget.\n", " | \n", " | With no argument return the list of all bindtags associated with\n", " | this widget. With a list of strings as argument the bindtags are\n", " | set to this list. The bindtags determine in which order events are\n", " | processed (see bind).\n", " | \n", " | clipboard_append(self, string, **kw)\n", " | Append STRING to the Tk clipboard.\n", " | \n", " | A widget specified at the optional displayof keyword\n", " | argument specifies the target display. The clipboard\n", " | can be retrieved with selection_get.\n", " | \n", " | clipboard_clear(self, **kw)\n", " | Clear the data in the Tk clipboard.\n", " | \n", " | A widget specified for the optional displayof keyword\n", " | argument specifies the target display.\n", " | \n", " | clipboard_get(self, **kw)\n", " | Retrieve data from the clipboard on window's display.\n", " | \n", " | The window keyword defaults to the root window of the Tkinter\n", " | application.\n", " | \n", " | The type keyword specifies the form in which the data is\n", " | to be returned and should be an atom name such as STRING\n", " | or FILE_NAME. Type defaults to STRING, except on X11, where the default\n", " | is to try UTF8_STRING and fall back to STRING.\n", " | \n", " | This command is equivalent to:\n", " | \n", " | selection_get(CLIPBOARD)\n", " | \n", " | columnconfigure = grid_columnconfigure(self, index, cnf={}, **kw)\n", " | Configure column INDEX of a grid.\n", " | \n", " | Valid resources are minsize (minimum size of the column),\n", " | weight (how much does additional space propagate to this column)\n", " | and pad (how much space to let additionally).\n", " | \n", " | configure(self, cnf=None, **kw)\n", " | Configure resources of a widget.\n", " | \n", " | The values for resources are specified as keyword\n", " | arguments. To get an overview about\n", " | the allowed keyword arguments call the method keys.\n", " | \n", " | deletecommand(self, name)\n", " | Internal function.\n", " | \n", " | Delete the Tcl command provided in NAME.\n", " | \n", " | event_add(self, virtual, *sequences)\n", " | Bind a virtual event VIRTUAL (of the form <>)\n", " | to an event SEQUENCE such that the virtual event is triggered\n", " | whenever SEQUENCE occurs.\n", " | \n", " | event_delete(self, virtual, *sequences)\n", " | Unbind a virtual event VIRTUAL from SEQUENCE.\n", " | \n", " | event_generate(self, sequence, **kw)\n", " | Generate an event SEQUENCE. Additional\n", " | keyword arguments specify parameter of the event\n", " | (e.g. x, y, rootx, rooty).\n", " | \n", " | event_info(self, virtual=None)\n", " | Return a list of all virtual events or the information\n", " | about the SEQUENCE bound to the virtual event VIRTUAL.\n", " | \n", " | focus = focus_set(self)\n", " | Direct input focus to this widget.\n", " | \n", " | If the application currently does not have the focus\n", " | this widget will get the focus if the application gets\n", " | the focus through the window manager.\n", " | \n", " | focus_displayof(self)\n", " | Return the widget which has currently the focus on the\n", " | display where this widget is located.\n", " | \n", " | Return None if the application does not have the focus.\n", " | \n", " | focus_get(self)\n", " | Return the widget which has currently the focus in the\n", " | application.\n", " | \n", " | Use focus_displayof to allow working with several\n", " | displays. Return None if application does not have\n", " | the focus.\n", " | \n", " | focus_lastfor(self)\n", " | Return the widget which would have the focus if top level\n", " | for this widget gets the focus from the window manager.\n", " | \n", " | focus_set(self)\n", " | Direct input focus to this widget.\n", " | \n", " | If the application currently does not have the focus\n", " | this widget will get the focus if the application gets\n", " | the focus through the window manager.\n", " | \n", " | getboolean(self, s)\n", " | Return a boolean value for Tcl boolean values true and false given as parameter.\n", " | \n", " | getdouble(self, s)\n", " | \n", " | getint(self, s)\n", " | \n", " | getvar(self, name='PY_VAR')\n", " | Return value of Tcl variable NAME.\n", " | \n", " | grab_current(self)\n", " | Return widget which has currently the grab in this application\n", " | or None.\n", " | \n", " | grab_release(self)\n", " | Release grab for this widget if currently set.\n", " | \n", " | grab_set(self)\n", " | Set grab for this widget.\n", " | \n", " | A grab directs all events to this and descendant\n", " | widgets in the application.\n", " | \n", " | grab_set_global(self)\n", " | Set global grab for this widget.\n", " | \n", " | A global grab directs all events to this and\n", " | descendant widgets on the display. Use with caution -\n", " | other applications do not get events anymore.\n", " | \n", " | grab_status(self)\n", " | Return None, \"local\" or \"global\" if this widget has\n", " | no, a local or a global grab.\n", " | \n", " | grid_anchor(self, anchor=None)\n", " | The anchor value controls how to place the grid within the\n", " | master when no row/column has any weight.\n", " | \n", " | The default anchor is nw.\n", " | \n", " | grid_bbox(self, column=None, row=None, col2=None, row2=None)\n", " | Return a tuple of integer coordinates for the bounding\n", " | box of this widget controlled by the geometry manager grid.\n", " | \n", " | If COLUMN, ROW is given the bounding box applies from\n", " | the cell with row and column 0 to the specified\n", " | cell. If COL2 and ROW2 are given the bounding box\n", " | starts at that cell.\n", " | \n", " | The returned integers specify the offset of the upper left\n", " | corner in the master widget and the width and height.\n", " | \n", " | grid_columnconfigure(self, index, cnf={}, **kw)\n", " | Configure column INDEX of a grid.\n", " | \n", " | Valid resources are minsize (minimum size of the column),\n", " | weight (how much does additional space propagate to this column)\n", " | and pad (how much space to let additionally).\n", " | \n", " | grid_location(self, x, y)\n", " | Return a tuple of column and row which identify the cell\n", " | at which the pixel at position X and Y inside the master\n", " | widget is located.\n", " | \n", " | grid_propagate(self, flag=['_noarg_'])\n", " | Set or get the status for propagation of geometry information.\n", " | \n", " | A boolean argument specifies whether the geometry information\n", " | of the slaves will determine the size of this widget. If no argument\n", " | is given, the current setting will be returned.\n", " | \n", " | grid_rowconfigure(self, index, cnf={}, **kw)\n", " | Configure row INDEX of a grid.\n", " | \n", " | Valid resources are minsize (minimum size of the row),\n", " | weight (how much does additional space propagate to this row)\n", " | and pad (how much space to let additionally).\n", " | \n", " | grid_size(self)\n", " | Return a tuple of the number of column and rows in the grid.\n", " | \n", " | grid_slaves(self, row=None, column=None)\n", " | Return a list of all slaves of this widget\n", " | in its packing order.\n", " | \n", " | image_names(self)\n", " | Return a list of all existing image names.\n", " | \n", " | image_types(self)\n", " | Return a list of all available image types (e.g. photo bitmap).\n", " | \n", " | keys(self)\n", " | Return a list of all resource names of this widget.\n", " | \n", " | lift = tkraise(self, aboveThis=None)\n", " | Raise this widget in the stacking order.\n", " | \n", " | lower(self, belowThis=None)\n", " | Lower this widget in the stacking order.\n", " | \n", " | mainloop(self, n=0)\n", " | Call the mainloop of Tk.\n", " | \n", " | nametowidget(self, name)\n", " | Return the Tkinter instance of a widget identified by\n", " | its Tcl name NAME.\n", " | \n", " | option_add(self, pattern, value, priority=None)\n", " | Set a VALUE (second parameter) for an option\n", " | PATTERN (first parameter).\n", " | \n", " | An optional third parameter gives the numeric priority\n", " | (defaults to 80).\n", " | \n", " | option_clear(self)\n", " | Clear the option database.\n", " | \n", " | It will be reloaded if option_add is called.\n", " | \n", " | option_get(self, name, className)\n", " | Return the value for an option NAME for this widget\n", " | with CLASSNAME.\n", " | \n", " | Values with higher priority override lower values.\n", " | \n", " | option_readfile(self, fileName, priority=None)\n", " | Read file FILENAME into the option database.\n", " | \n", " | An optional second parameter gives the numeric\n", " | priority.\n", " | \n", " | pack_propagate(self, flag=['_noarg_'])\n", " | Set or get the status for propagation of geometry information.\n", " | \n", " | A boolean argument specifies whether the geometry information\n", " | of the slaves will determine the size of this widget. If no argument\n", " | is given the current setting will be returned.\n", " | \n", " | pack_slaves(self)\n", " | Return a list of all slaves of this widget\n", " | in its packing order.\n", " | \n", " | place_slaves(self)\n", " | Return a list of all slaves of this widget\n", " | in its packing order.\n", " | \n", " | propagate = pack_propagate(self, flag=['_noarg_'])\n", " | Set or get the status for propagation of geometry information.\n", " | \n", " | A boolean argument specifies whether the geometry information\n", " | of the slaves will determine the size of this widget. If no argument\n", " | is given the current setting will be returned.\n", " | \n", " | quit(self)\n", " | Quit the Tcl interpreter. All widgets will be destroyed.\n", " | \n", " | register = _register(self, func, subst=None, needcleanup=1)\n", " | Return a newly created Tcl function. If this\n", " | function is called, the Python function FUNC will\n", " | be executed. An optional function SUBST can\n", " | be given which will be executed before FUNC.\n", " | \n", " | rowconfigure = grid_rowconfigure(self, index, cnf={}, **kw)\n", " | Configure row INDEX of a grid.\n", " | \n", " | Valid resources are minsize (minimum size of the row),\n", " | weight (how much does additional space propagate to this row)\n", " | and pad (how much space to let additionally).\n", " | \n", " | selection_clear(self, **kw)\n", " | Clear the current X selection.\n", " | \n", " | selection_get(self, **kw)\n", " | Return the contents of the current X selection.\n", " | \n", " | A keyword parameter selection specifies the name of\n", " | the selection and defaults to PRIMARY. A keyword\n", " | parameter displayof specifies a widget on the display\n", " | to use. A keyword parameter type specifies the form of data to be\n", " | fetched, defaulting to STRING except on X11, where UTF8_STRING is tried\n", " | before STRING.\n", " | \n", " | selection_handle(self, command, **kw)\n", " | Specify a function COMMAND to call if the X\n", " | selection owned by this widget is queried by another\n", " | application.\n", " | \n", " | This function must return the contents of the\n", " | selection. The function will be called with the\n", " | arguments OFFSET and LENGTH which allows the chunking\n", " | of very long selections. The following keyword\n", " | parameters can be provided:\n", " | selection - name of the selection (default PRIMARY),\n", " | type - type of the selection (e.g. STRING, FILE_NAME).\n", " | \n", " | selection_own(self, **kw)\n", " | Become owner of X selection.\n", " | \n", " | A keyword parameter selection specifies the name of\n", " | the selection (default PRIMARY).\n", " | \n", " | selection_own_get(self, **kw)\n", " | Return owner of X selection.\n", " | \n", " | The following keyword parameter can\n", " | be provided:\n", " | selection - name of the selection (default PRIMARY),\n", " | type - type of the selection (e.g. STRING, FILE_NAME).\n", " | \n", " | send(self, interp, cmd, *args)\n", " | Send Tcl command CMD to different interpreter INTERP to be executed.\n", " | \n", " | setvar(self, name='PY_VAR', value='1')\n", " | Set Tcl variable NAME to VALUE.\n", " | \n", " | size = grid_size(self)\n", " | Return a tuple of the number of column and rows in the grid.\n", " | \n", " | slaves = pack_slaves(self)\n", " | Return a list of all slaves of this widget\n", " | in its packing order.\n", " | \n", " | tk_bisque(self)\n", " | Change the color scheme to light brown as used in Tk 3.6 and before.\n", " | \n", " | tk_focusFollowsMouse(self)\n", " | The widget under mouse will get automatically focus. Can not\n", " | be disabled easily.\n", " | \n", " | tk_focusNext(self)\n", " | Return the next widget in the focus order which follows\n", " | widget which has currently the focus.\n", " | \n", " | The focus order first goes to the next child, then to\n", " | the children of the child recursively and then to the\n", " | next sibling which is higher in the stacking order. A\n", " | widget is omitted if it has the takefocus resource set\n", " | to 0.\n", " | \n", " | tk_focusPrev(self)\n", " | Return previous widget in the focus order. See tk_focusNext for details.\n", " | \n", " | tk_setPalette(self, *args, **kw)\n", " | Set a new color scheme for all widget elements.\n", " | \n", " | A single color as argument will cause that all colors of Tk\n", " | widget elements are derived from this.\n", " | Alternatively several keyword parameters and its associated\n", " | colors can be given. The following keywords are valid:\n", " | activeBackground, foreground, selectColor,\n", " | activeForeground, highlightBackground, selectBackground,\n", " | background, highlightColor, selectForeground,\n", " | disabledForeground, insertBackground, troughColor.\n", " | \n", " | tk_strictMotif(self, boolean=None)\n", " | Set Tcl internal variable, whether the look and feel\n", " | should adhere to Motif.\n", " | \n", " | A parameter of 1 means adhere to Motif (e.g. no color\n", " | change if mouse passes over slider).\n", " | Returns the set value.\n", " | \n", " | tkraise(self, aboveThis=None)\n", " | Raise this widget in the stacking order.\n", " | \n", " | unbind_all(self, sequence)\n", " | Unbind for all widgets for event SEQUENCE all functions.\n", " | \n", " | unbind_class(self, className, sequence)\n", " | Unbind for all widgets with bindtag CLASSNAME for event SEQUENCE\n", " | all functions.\n", " | \n", " | update(self)\n", " | Enter event loop until all pending events have been processed by Tcl.\n", " | \n", " | update_idletasks(self)\n", " | Enter event loop until all idle callbacks have been called. This\n", " | will update the display of windows but not process events caused by\n", " | the user.\n", " | \n", " | wait_variable(self, name='PY_VAR')\n", " | Wait until the variable is modified.\n", " | \n", " | A parameter of type IntVar, StringVar, DoubleVar or\n", " | BooleanVar must be given.\n", " | \n", " | wait_visibility(self, window=None)\n", " | Wait until the visibility of a WIDGET changes\n", " | (e.g. it appears).\n", " | \n", " | If no parameter is given self is used.\n", " | \n", " | wait_window(self, window=None)\n", " | Wait until a WIDGET is destroyed.\n", " | \n", " | If no parameter is given self is used.\n", " | \n", " | waitvar = wait_variable(self, name='PY_VAR')\n", " | Wait until the variable is modified.\n", " | \n", " | A parameter of type IntVar, StringVar, DoubleVar or\n", " | BooleanVar must be given.\n", " | \n", " | winfo_atom(self, name, displayof=0)\n", " | Return integer which represents atom NAME.\n", " | \n", " | winfo_atomname(self, id, displayof=0)\n", " | Return name of atom with identifier ID.\n", " | \n", " | winfo_cells(self)\n", " | Return number of cells in the colormap for this widget.\n", " | \n", " | winfo_children(self)\n", " | Return a list of all widgets which are children of this widget.\n", " | \n", " | winfo_class(self)\n", " | Return window class name of this widget.\n", " | \n", " | winfo_colormapfull(self)\n", " | Return true if at the last color request the colormap was full.\n", " | \n", " | winfo_containing(self, rootX, rootY, displayof=0)\n", " | Return the widget which is at the root coordinates ROOTX, ROOTY.\n", " | \n", " | winfo_depth(self)\n", " | Return the number of bits per pixel.\n", " | \n", " | winfo_exists(self)\n", " | Return true if this widget exists.\n", " | \n", " | winfo_fpixels(self, number)\n", " | Return the number of pixels for the given distance NUMBER\n", " | (e.g. \"3c\") as float.\n", " | \n", " | winfo_geometry(self)\n", " | Return geometry string for this widget in the form \"widthxheight+X+Y\".\n", " | \n", " | winfo_height(self)\n", " | Return height of this widget.\n", " | \n", " | winfo_id(self)\n", " | Return identifier ID for this widget.\n", " | \n", " | winfo_interps(self, displayof=0)\n", " | Return the name of all Tcl interpreters for this display.\n", " | \n", " | winfo_ismapped(self)\n", " | Return true if this widget is mapped.\n", " | \n", " | winfo_manager(self)\n", " | Return the window manager name for this widget.\n", " | \n", " | winfo_name(self)\n", " | Return the name of this widget.\n", " | \n", " | winfo_parent(self)\n", " | Return the name of the parent of this widget.\n", " | \n", " | winfo_pathname(self, id, displayof=0)\n", " | Return the pathname of the widget given by ID.\n", " | \n", " | winfo_pixels(self, number)\n", " | Rounded integer value of winfo_fpixels.\n", " | \n", " | winfo_pointerx(self)\n", " | Return the x coordinate of the pointer on the root window.\n", " | \n", " | winfo_pointerxy(self)\n", " | Return a tuple of x and y coordinates of the pointer on the root window.\n", " | \n", " | winfo_pointery(self)\n", " | Return the y coordinate of the pointer on the root window.\n", " | \n", " | winfo_reqheight(self)\n", " | Return requested height of this widget.\n", " | \n", " | winfo_reqwidth(self)\n", " | Return requested width of this widget.\n", " | \n", " | winfo_rgb(self, color)\n", " | Return tuple of decimal values for red, green, blue for\n", " | COLOR in this widget.\n", " | \n", " | winfo_rootx(self)\n", " | Return x coordinate of upper left corner of this widget on the\n", " | root window.\n", " | \n", " | winfo_rooty(self)\n", " | Return y coordinate of upper left corner of this widget on the\n", " | root window.\n", " | \n", " | winfo_screen(self)\n", " | Return the screen name of this widget.\n", " | \n", " | winfo_screencells(self)\n", " | Return the number of the cells in the colormap of the screen\n", " | of this widget.\n", " | \n", " | winfo_screendepth(self)\n", " | Return the number of bits per pixel of the root window of the\n", " | screen of this widget.\n", " | \n", " | winfo_screenheight(self)\n", " | Return the number of pixels of the height of the screen of this widget\n", " | in pixel.\n", " | \n", " | winfo_screenmmheight(self)\n", " | Return the number of pixels of the height of the screen of\n", " | this widget in mm.\n", " | \n", " | winfo_screenmmwidth(self)\n", " | Return the number of pixels of the width of the screen of\n", " | this widget in mm.\n", " | \n", " | winfo_screenvisual(self)\n", " | Return one of the strings directcolor, grayscale, pseudocolor,\n", " | staticcolor, staticgray, or truecolor for the default\n", " | colormodel of this screen.\n", " | \n", " | winfo_screenwidth(self)\n", " | Return the number of pixels of the width of the screen of\n", " | this widget in pixel.\n", " | \n", " | winfo_server(self)\n", " | Return information of the X-Server of the screen of this widget in\n", " | the form \"XmajorRminor vendor vendorVersion\".\n", " | \n", " | winfo_toplevel(self)\n", " | Return the toplevel widget of this widget.\n", " | \n", " | winfo_viewable(self)\n", " | Return true if the widget and all its higher ancestors are mapped.\n", " | \n", " | winfo_visual(self)\n", " | Return one of the strings directcolor, grayscale, pseudocolor,\n", " | staticcolor, staticgray, or truecolor for the\n", " | colormodel of this widget.\n", " | \n", " | winfo_visualid(self)\n", " | Return the X identifier for the visual for this widget.\n", " | \n", " | winfo_visualsavailable(self, includeids=False)\n", " | Return a list of all visuals available for the screen\n", " | of this widget.\n", " | \n", " | Each item in the list consists of a visual name (see winfo_visual), a\n", " | depth and if includeids is true is given also the X identifier.\n", " | \n", " | winfo_vrootheight(self)\n", " | Return the height of the virtual root window associated with this\n", " | widget in pixels. If there is no virtual root window return the\n", " | height of the screen.\n", " | \n", " | winfo_vrootwidth(self)\n", " | Return the width of the virtual root window associated with this\n", " | widget in pixel. If there is no virtual root window return the\n", " | width of the screen.\n", " | \n", " | winfo_vrootx(self)\n", " | Return the x offset of the virtual root relative to the root\n", " | window of the screen of this widget.\n", " | \n", " | winfo_vrooty(self)\n", " | Return the y offset of the virtual root relative to the root\n", " | window of the screen of this widget.\n", " | \n", " | winfo_width(self)\n", " | Return the width of this widget.\n", " | \n", " | winfo_x(self)\n", " | Return the x coordinate of the upper left corner of this widget\n", " | in the parent.\n", " | \n", " | winfo_y(self)\n", " | Return the y coordinate of the upper left corner of this widget\n", " | in the parent.\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data descriptors inherited from tkinter.Misc:\n", " | \n", " | __dict__\n", " | dictionary for instance variables (if defined)\n", " | \n", " | __weakref__\n", " | list of weak references to the object (if defined)\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from tkinter.Pack:\n", " | \n", " | forget = pack_forget(self)\n", " | Unmap this widget and do not use it for the packing order.\n", " | \n", " | info = pack_info(self)\n", " | Return information about the packing options\n", " | for this widget.\n", " | \n", " | pack = pack_configure(self, cnf={}, **kw)\n", " | Pack a widget in the parent widget. Use as options:\n", " | after=widget - pack it after you have packed widget\n", " | anchor=NSEW (or subset) - position widget according to\n", " | given direction\n", " | before=widget - pack it before you will pack widget\n", " | expand=bool - expand widget if parent size grows\n", " | fill=NONE or X or Y or BOTH - fill widget if widget grows\n", " | in=master - use master to contain this widget\n", " | in_=master - see 'in' option description\n", " | ipadx=amount - add internal padding in x direction\n", " | ipady=amount - add internal padding in y direction\n", " | padx=amount - add padding in x direction\n", " | pady=amount - add padding in y direction\n", " | side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget.\n", " | \n", " | pack_configure(self, cnf={}, **kw)\n", " | Pack a widget in the parent widget. Use as options:\n", " | after=widget - pack it after you have packed widget\n", " | anchor=NSEW (or subset) - position widget according to\n", " | given direction\n", " | before=widget - pack it before you will pack widget\n", " | expand=bool - expand widget if parent size grows\n", " | fill=NONE or X or Y or BOTH - fill widget if widget grows\n", " | in=master - use master to contain this widget\n", " | in_=master - see 'in' option description\n", " | ipadx=amount - add internal padding in x direction\n", " | ipady=amount - add internal padding in y direction\n", " | padx=amount - add padding in x direction\n", " | pady=amount - add padding in y direction\n", " | side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget.\n", " | \n", " | pack_forget(self)\n", " | Unmap this widget and do not use it for the packing order.\n", " | \n", " | pack_info(self)\n", " | Return information about the packing options\n", " | for this widget.\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from tkinter.Place:\n", " | \n", " | place = place_configure(self, cnf={}, **kw)\n", " | Place a widget in the parent widget. Use as options:\n", " | in=master - master relative to which the widget is placed\n", " | in_=master - see 'in' option description\n", " | x=amount - locate anchor of this widget at position x of master\n", " | y=amount - locate anchor of this widget at position y of master\n", " | relx=amount - locate anchor of this widget between 0.0 and 1.0\n", " | relative to width of master (1.0 is right edge)\n", " | rely=amount - locate anchor of this widget between 0.0 and 1.0\n", " | relative to height of master (1.0 is bottom edge)\n", " | anchor=NSEW (or subset) - position anchor according to given direction\n", " | width=amount - width of this widget in pixel\n", " | height=amount - height of this widget in pixel\n", " | relwidth=amount - width of this widget between 0.0 and 1.0\n", " | relative to width of master (1.0 is the same width\n", " | as the master)\n", " | relheight=amount - height of this widget between 0.0 and 1.0\n", " | relative to height of master (1.0 is the same\n", " | height as the master)\n", " | bordermode=\"inside\" or \"outside\" - whether to take border width of\n", " | master widget into account\n", " | \n", " | place_configure(self, cnf={}, **kw)\n", " | Place a widget in the parent widget. Use as options:\n", " | in=master - master relative to which the widget is placed\n", " | in_=master - see 'in' option description\n", " | x=amount - locate anchor of this widget at position x of master\n", " | y=amount - locate anchor of this widget at position y of master\n", " | relx=amount - locate anchor of this widget between 0.0 and 1.0\n", " | relative to width of master (1.0 is right edge)\n", " | rely=amount - locate anchor of this widget between 0.0 and 1.0\n", " | relative to height of master (1.0 is bottom edge)\n", " | anchor=NSEW (or subset) - position anchor according to given direction\n", " | width=amount - width of this widget in pixel\n", " | height=amount - height of this widget in pixel\n", " | relwidth=amount - width of this widget between 0.0 and 1.0\n", " | relative to width of master (1.0 is the same width\n", " | as the master)\n", " | relheight=amount - height of this widget between 0.0 and 1.0\n", " | relative to height of master (1.0 is the same\n", " | height as the master)\n", " | bordermode=\"inside\" or \"outside\" - whether to take border width of\n", " | master widget into account\n", " | \n", " | place_forget(self)\n", " | Unmap this widget.\n", " | \n", " | place_info(self)\n", " | Return information about the placing options\n", " | for this widget.\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from tkinter.Grid:\n", " | \n", " | grid = grid_configure(self, cnf={}, **kw)\n", " | Position a widget in the parent widget in a grid. Use as options:\n", " | column=number - use cell identified with given column (starting with 0)\n", " | columnspan=number - this widget will span several columns\n", " | in=master - use master to contain this widget\n", " | in_=master - see 'in' option description\n", " | ipadx=amount - add internal padding in x direction\n", " | ipady=amount - add internal padding in y direction\n", " | padx=amount - add padding in x direction\n", " | pady=amount - add padding in y direction\n", " | row=number - use cell identified with given row (starting with 0)\n", " | rowspan=number - this widget will span several rows\n", " | sticky=NSEW - if cell is larger on which sides will this\n", " | widget stick to the cell boundary\n", " | \n", " | grid_configure(self, cnf={}, **kw)\n", " | Position a widget in the parent widget in a grid. Use as options:\n", " | column=number - use cell identified with given column (starting with 0)\n", " | columnspan=number - this widget will span several columns\n", " | in=master - use master to contain this widget\n", " | in_=master - see 'in' option description\n", " | ipadx=amount - add internal padding in x direction\n", " | ipady=amount - add internal padding in y direction\n", " | padx=amount - add padding in x direction\n", " | pady=amount - add padding in y direction\n", " | row=number - use cell identified with given row (starting with 0)\n", " | rowspan=number - this widget will span several rows\n", " | sticky=NSEW - if cell is larger on which sides will this\n", " | widget stick to the cell boundary\n", " | \n", " | grid_forget(self)\n", " | Unmap this widget.\n", " | \n", " | grid_info(self)\n", " | Return information about the options\n", " | for positioning this widget in a grid.\n", " | \n", " | grid_remove(self)\n", " | Unmap this widget but remember the grid options.\n", " | \n", " | location = grid_location(self, x, y)\n", " | Return a tuple of column and row which identify the cell\n", " | at which the pixel at position X and Y inside the master\n", " | widget is located.\n", " \n", " class Shape(builtins.object)\n", " | Data structure modeling shapes.\n", " | \n", " | attribute _type is one of \"polygon\", \"image\", \"compound\"\n", " | attribute _data is - depending on _type a poygon-tuple,\n", " | an image or a list constructed using the addcomponent method.\n", " | \n", " | Methods defined here:\n", " | \n", " | __init__(self, type_, data=None)\n", " | Initialize self. See help(type(self)) for accurate signature.\n", " | \n", " | addcomponent(self, poly, fill, outline=None)\n", " | Add component to a shape of type compound.\n", " | \n", " | Arguments: poly is a polygon, i. e. a tuple of number pairs.\n", " | fill is the fillcolor of the component,\n", " | outline is the outline color of the component.\n", " | \n", " | call (for a Shapeobject namend s):\n", " | -- s.addcomponent(((0,0), (10,10), (-10,10)), \"red\", \"blue\")\n", " | \n", " | Example:\n", " | >>> poly = ((0,0),(10,-5),(0,10),(-10,-5))\n", " | >>> s = Shape(\"compound\")\n", " | >>> s.addcomponent(poly, \"red\", \"blue\")\n", " | >>> # .. add more components and then use register_shape()\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data descriptors defined here:\n", " | \n", " | __dict__\n", " | dictionary for instance variables (if defined)\n", " | \n", " | __weakref__\n", " | list of weak references to the object (if defined)\n", " \n", " class Terminator(builtins.Exception)\n", " | Will be raised in TurtleScreen.update, if _RUNNING becomes False.\n", " | \n", " | This stops execution of a turtle graphics script.\n", " | Main purpose: use in the Demo-Viewer turtle.Demo.py.\n", " | \n", " | Method resolution order:\n", " | Terminator\n", " | builtins.Exception\n", " | builtins.BaseException\n", " | builtins.object\n", " | \n", " | Data descriptors defined here:\n", " | \n", " | __weakref__\n", " | list of weak references to the object (if defined)\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from builtins.Exception:\n", " | \n", " | __init__(self, /, *args, **kwargs)\n", " | Initialize self. See help(type(self)) for accurate signature.\n", " | \n", " | __new__(*args, **kwargs) from builtins.type\n", " | Create and return a new object. See help(type) for accurate signature.\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from builtins.BaseException:\n", " | \n", " | __delattr__(self, name, /)\n", " | Implement delattr(self, name).\n", " | \n", " | __getattribute__(self, name, /)\n", " | Return getattr(self, name).\n", " | \n", " | __reduce__(...)\n", " | helper for pickle\n", " | \n", " | __repr__(self, /)\n", " | Return repr(self).\n", " | \n", " | __setattr__(self, name, value, /)\n", " | Implement setattr(self, name, value).\n", " | \n", " | __setstate__(...)\n", " | \n", " | __str__(self, /)\n", " | Return str(self).\n", " | \n", " | with_traceback(...)\n", " | Exception.with_traceback(tb) --\n", " | set self.__traceback__ to tb and return self.\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data descriptors inherited from builtins.BaseException:\n", " | \n", " | __cause__\n", " | exception cause\n", " | \n", " | __context__\n", " | exception context\n", " | \n", " | __dict__\n", " | \n", " | __suppress_context__\n", " | \n", " | __traceback__\n", " | \n", " | args\n", " \n", " class Turtle(RawTurtle)\n", " | RawTurtle auto-creating (scrolled) canvas.\n", " | \n", " | When a Turtle object is created or a function derived from some\n", " | Turtle method is called a TurtleScreen object is automatically created.\n", " | \n", " | Method resolution order:\n", " | Turtle\n", " | RawTurtle\n", " | TPen\n", " | TNavigator\n", " | builtins.object\n", " | \n", " | Methods defined here:\n", " | \n", " | __init__(self, shape='classic', undobuffersize=1000, visible=True)\n", " | Initialize self. See help(type(self)) for accurate signature.\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from RawTurtle:\n", " | \n", " | begin_fill(self)\n", " | Called just before drawing a shape to be filled.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"black\", \"red\")\n", " | >>> turtle.begin_fill()\n", " | >>> turtle.circle(60)\n", " | >>> turtle.end_fill()\n", " | \n", " | begin_poly(self)\n", " | Start recording the vertices of a polygon.\n", " | \n", " | No argument.\n", " | \n", " | Start recording the vertices of a polygon. Current turtle position\n", " | is first point of polygon.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.begin_poly()\n", " | \n", " | clear(self)\n", " | Delete the turtle's drawings from the screen. Do not move turtle.\n", " | \n", " | No arguments.\n", " | \n", " | Delete the turtle's drawings from the screen. Do not move turtle.\n", " | State and position of the turtle as well as drawings of other\n", " | turtles are not affected.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.clear()\n", " | \n", " | clearstamp(self, stampid)\n", " | Delete stamp with given stampid\n", " | \n", " | Argument:\n", " | stampid - an integer, must be return value of previous stamp() call.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"blue\")\n", " | >>> astamp = turtle.stamp()\n", " | >>> turtle.fd(50)\n", " | >>> turtle.clearstamp(astamp)\n", " | \n", " | clearstamps(self, n=None)\n", " | Delete all or first/last n of turtle's stamps.\n", " | \n", " | Optional argument:\n", " | n -- an integer\n", " | \n", " | If n is None, delete all of pen's stamps,\n", " | else if n > 0 delete first n stamps\n", " | else if n < 0 delete last n stamps.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> for i in range(8):\n", " | ... turtle.stamp(); turtle.fd(30)\n", " | ...\n", " | >>> turtle.clearstamps(2)\n", " | >>> turtle.clearstamps(-2)\n", " | >>> turtle.clearstamps()\n", " | \n", " | clone(self)\n", " | Create and return a clone of the turtle.\n", " | \n", " | No argument.\n", " | \n", " | Create and return a clone of the turtle with same position, heading\n", " | and turtle properties.\n", " | \n", " | Example (for a Turtle instance named mick):\n", " | mick = Turtle()\n", " | joe = mick.clone()\n", " | \n", " | dot(self, size=None, *color)\n", " | Draw a dot with diameter size, using color.\n", " | \n", " | Optional arguments:\n", " | size -- an integer >= 1 (if given)\n", " | color -- a colorstring or a numeric color tuple\n", " | \n", " | Draw a circular dot with diameter size, using color.\n", " | If size is not given, the maximum of pensize+4 and 2*pensize is used.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.dot()\n", " | >>> turtle.fd(50); turtle.dot(20, \"blue\"); turtle.fd(50)\n", " | \n", " | end_fill(self)\n", " | Fill the shape drawn after the call begin_fill().\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"black\", \"red\")\n", " | >>> turtle.begin_fill()\n", " | >>> turtle.circle(60)\n", " | >>> turtle.end_fill()\n", " | \n", " | end_poly(self)\n", " | Stop recording the vertices of a polygon.\n", " | \n", " | No argument.\n", " | \n", " | Stop recording the vertices of a polygon. Current turtle position is\n", " | last point of polygon. This will be connected with the first point.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.end_poly()\n", " | \n", " | filling(self)\n", " | Return fillstate (True if filling, False else).\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.begin_fill()\n", " | >>> if turtle.filling():\n", " | ... turtle.pensize(5)\n", " | ... else:\n", " | ... turtle.pensize(3)\n", " | \n", " | get_poly(self)\n", " | Return the lastly recorded polygon.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> p = turtle.get_poly()\n", " | >>> turtle.register_shape(\"myFavouriteShape\", p)\n", " | \n", " | get_shapepoly(self)\n", " | Return the current shape polygon as tuple of coordinate pairs.\n", " | \n", " | No argument.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"square\")\n", " | >>> turtle.shapetransform(4, -1, 0, 2)\n", " | >>> turtle.get_shapepoly()\n", " | ((50, -20), (30, 20), (-50, 20), (-30, -20))\n", " | \n", " | getpen = getturtle(self)\n", " | Return the Turtleobject itself.\n", " | \n", " | No argument.\n", " | \n", " | Only reasonable use: as a function to return the 'anonymous turtle':\n", " | \n", " | Example:\n", " | >>> pet = getturtle()\n", " | >>> pet.fd(50)\n", " | >>> pet\n", " | \n", " | >>> turtles()\n", " | []\n", " | \n", " | getscreen(self)\n", " | Return the TurtleScreen object, the turtle is drawing on.\n", " | \n", " | No argument.\n", " | \n", " | Return the TurtleScreen object, the turtle is drawing on.\n", " | So TurtleScreen-methods can be called for that object.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> ts = turtle.getscreen()\n", " | >>> ts\n", " | \n", " | >>> ts.bgcolor(\"pink\")\n", " | \n", " | getturtle(self)\n", " | Return the Turtleobject itself.\n", " | \n", " | No argument.\n", " | \n", " | Only reasonable use: as a function to return the 'anonymous turtle':\n", " | \n", " | Example:\n", " | >>> pet = getturtle()\n", " | >>> pet.fd(50)\n", " | >>> pet\n", " | \n", " | >>> turtles()\n", " | []\n", " | \n", " | onclick(self, fun, btn=1, add=None)\n", " | Bind fun to mouse-click event on this turtle on canvas.\n", " | \n", " | Arguments:\n", " | fun -- a function with two arguments, to which will be assigned\n", " | the coordinates of the clicked point on the canvas.\n", " | num -- number of the mouse-button defaults to 1 (left mouse button).\n", " | add -- True or False. If True, new binding will be added, otherwise\n", " | it will replace a former binding.\n", " | \n", " | Example for the anonymous turtle, i. e. the procedural way:\n", " | \n", " | >>> def turn(x, y):\n", " | ... left(360)\n", " | ...\n", " | >>> onclick(turn) # Now clicking into the turtle will turn it.\n", " | >>> onclick(None) # event-binding will be removed\n", " | \n", " | ondrag(self, fun, btn=1, add=None)\n", " | Bind fun to mouse-move event on this turtle on canvas.\n", " | \n", " | Arguments:\n", " | fun -- a function with two arguments, to which will be assigned\n", " | the coordinates of the clicked point on the canvas.\n", " | num -- number of the mouse-button defaults to 1 (left mouse button).\n", " | \n", " | Every sequence of mouse-move-events on a turtle is preceded by a\n", " | mouse-click event on that turtle.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.ondrag(turtle.goto)\n", " | \n", " | Subsequently clicking and dragging a Turtle will move it\n", " | across the screen thereby producing handdrawings (if pen is\n", " | down).\n", " | \n", " | onrelease(self, fun, btn=1, add=None)\n", " | Bind fun to mouse-button-release event on this turtle on canvas.\n", " | \n", " | Arguments:\n", " | fun -- a function with two arguments, to which will be assigned\n", " | the coordinates of the clicked point on the canvas.\n", " | num -- number of the mouse-button defaults to 1 (left mouse button).\n", " | \n", " | Example (for a MyTurtle instance named joe):\n", " | >>> class MyTurtle(Turtle):\n", " | ... def glow(self,x,y):\n", " | ... self.fillcolor(\"red\")\n", " | ... def unglow(self,x,y):\n", " | ... self.fillcolor(\"\")\n", " | ...\n", " | >>> joe = MyTurtle()\n", " | >>> joe.onclick(joe.glow)\n", " | >>> joe.onrelease(joe.unglow)\n", " | \n", " | Clicking on joe turns fillcolor red, unclicking turns it to\n", " | transparent.\n", " | \n", " | reset(self)\n", " | Delete the turtle's drawings and restore its default values.\n", " | \n", " | No argument.\n", " | \n", " | Delete the turtle's drawings from the screen, re-center the turtle\n", " | and set variables to the default values.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00,-22.00)\n", " | >>> turtle.heading()\n", " | 100.0\n", " | >>> turtle.reset()\n", " | >>> turtle.position()\n", " | (0.00,0.00)\n", " | >>> turtle.heading()\n", " | 0.0\n", " | \n", " | settiltangle(self, angle)\n", " | Rotate the turtleshape to point in the specified direction\n", " | \n", " | Argument: angle -- number\n", " | \n", " | Rotate the turtleshape to point in the direction specified by angle,\n", " | regardless of its current tilt-angle. DO NOT change the turtle's\n", " | heading (direction of movement).\n", " | \n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.settiltangle(45)\n", " | >>> stamp()\n", " | >>> turtle.fd(50)\n", " | >>> turtle.settiltangle(-45)\n", " | >>> stamp()\n", " | >>> turtle.fd(50)\n", " | \n", " | setundobuffer(self, size)\n", " | Set or disable undobuffer.\n", " | \n", " | Argument:\n", " | size -- an integer or None\n", " | \n", " | If size is an integer an empty undobuffer of given size is installed.\n", " | Size gives the maximum number of turtle-actions that can be undone\n", " | by the undo() function.\n", " | If size is None, no undobuffer is present.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.setundobuffer(42)\n", " | \n", " | shape(self, name=None)\n", " | Set turtle shape to shape with given name / return current shapename.\n", " | \n", " | Optional argument:\n", " | name -- a string, which is a valid shapename\n", " | \n", " | Set turtle shape to shape with given name or, if name is not given,\n", " | return name of current shape.\n", " | Shape with name must exist in the TurtleScreen's shape dictionary.\n", " | Initially there are the following polygon shapes:\n", " | 'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'.\n", " | To learn about how to deal with shapes see Screen-method register_shape.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.shape()\n", " | 'arrow'\n", " | >>> turtle.shape(\"turtle\")\n", " | >>> turtle.shape()\n", " | 'turtle'\n", " | \n", " | shapesize(self, stretch_wid=None, stretch_len=None, outline=None)\n", " | Set/return turtle's stretchfactors/outline. Set resizemode to \"user\".\n", " | \n", " | Optional arguments:\n", " | stretch_wid : positive number\n", " | stretch_len : positive number\n", " | outline : positive number\n", " | \n", " | Return or set the pen's attributes x/y-stretchfactors and/or outline.\n", " | Set resizemode to \"user\".\n", " | If and only if resizemode is set to \"user\", the turtle will be displayed\n", " | stretched according to its stretchfactors:\n", " | stretch_wid is stretchfactor perpendicular to orientation\n", " | stretch_len is stretchfactor in direction of turtles orientation.\n", " | outline determines the width of the shapes's outline.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.resizemode(\"user\")\n", " | >>> turtle.shapesize(5, 5, 12)\n", " | >>> turtle.shapesize(outline=8)\n", " | \n", " | shapetransform(self, t11=None, t12=None, t21=None, t22=None)\n", " | Set or return the current transformation matrix of the turtle shape.\n", " | \n", " | Optional arguments: t11, t12, t21, t22 -- numbers.\n", " | \n", " | If none of the matrix elements are given, return the transformation\n", " | matrix.\n", " | Otherwise set the given elements and transform the turtleshape\n", " | according to the matrix consisting of first row t11, t12 and\n", " | second row t21, 22.\n", " | Modify stretchfactor, shearfactor and tiltangle according to the\n", " | given matrix.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"square\")\n", " | >>> turtle.shapesize(4,2)\n", " | >>> turtle.shearfactor(-0.5)\n", " | >>> turtle.shapetransform()\n", " | (4.0, -1.0, -0.0, 2.0)\n", " | \n", " | shearfactor(self, shear=None)\n", " | Set or return the current shearfactor.\n", " | \n", " | Optional argument: shear -- number, tangent of the shear angle\n", " | \n", " | Shear the turtleshape according to the given shearfactor shear,\n", " | which is the tangent of the shear angle. DO NOT change the\n", " | turtle's heading (direction of movement).\n", " | If shear is not given: return the current shearfactor, i. e. the\n", " | tangent of the shear angle, by which lines parallel to the\n", " | heading of the turtle are sheared.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.shearfactor(0.5)\n", " | >>> turtle.shearfactor()\n", " | >>> 0.5\n", " | \n", " | stamp(self)\n", " | Stamp a copy of the turtleshape onto the canvas and return its id.\n", " | \n", " | No argument.\n", " | \n", " | Stamp a copy of the turtle shape onto the canvas at the current\n", " | turtle position. Return a stamp_id for that stamp, which can be\n", " | used to delete it by calling clearstamp(stamp_id).\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color(\"blue\")\n", " | >>> turtle.stamp()\n", " | 13\n", " | >>> turtle.fd(50)\n", " | \n", " | tilt(self, angle)\n", " | Rotate the turtleshape by angle.\n", " | \n", " | Argument:\n", " | angle - a number\n", " | \n", " | Rotate the turtleshape by angle from its current tilt-angle,\n", " | but do NOT change the turtle's heading (direction of movement).\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.tilt(30)\n", " | >>> turtle.fd(50)\n", " | >>> turtle.tilt(30)\n", " | >>> turtle.fd(50)\n", " | \n", " | tiltangle(self, angle=None)\n", " | Set or return the current tilt-angle.\n", " | \n", " | Optional argument: angle -- number\n", " | \n", " | Rotate the turtleshape to point in the direction specified by angle,\n", " | regardless of its current tilt-angle. DO NOT change the turtle's\n", " | heading (direction of movement).\n", " | If angle is not given: return the current tilt-angle, i. e. the angle\n", " | between the orientation of the turtleshape and the heading of the\n", " | turtle (its direction of movement).\n", " | \n", " | Deprecated since Python 3.1\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.shape(\"circle\")\n", " | >>> turtle.shapesize(5,2)\n", " | >>> turtle.tilt(45)\n", " | >>> turtle.tiltangle()\n", " | \n", " | turtlesize = shapesize(self, stretch_wid=None, stretch_len=None, outline=None)\n", " | Set/return turtle's stretchfactors/outline. Set resizemode to \"user\".\n", " | \n", " | Optional arguments:\n", " | stretch_wid : positive number\n", " | stretch_len : positive number\n", " | outline : positive number\n", " | \n", " | Return or set the pen's attributes x/y-stretchfactors and/or outline.\n", " | Set resizemode to \"user\".\n", " | If and only if resizemode is set to \"user\", the turtle will be displayed\n", " | stretched according to its stretchfactors:\n", " | stretch_wid is stretchfactor perpendicular to orientation\n", " | stretch_len is stretchfactor in direction of turtles orientation.\n", " | outline determines the width of the shapes's outline.\n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.resizemode(\"user\")\n", " | >>> turtle.shapesize(5, 5, 12)\n", " | >>> turtle.shapesize(outline=8)\n", " | \n", " | undo(self)\n", " | undo (repeatedly) the last turtle action.\n", " | \n", " | No argument.\n", " | \n", " | undo (repeatedly) the last turtle action.\n", " | Number of available undo actions is determined by the size of\n", " | the undobuffer.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> for i in range(4):\n", " | ... turtle.fd(50); turtle.lt(80)\n", " | ...\n", " | >>> for i in range(8):\n", " | ... turtle.undo()\n", " | ...\n", " | \n", " | undobufferentries(self)\n", " | Return count of entries in the undobuffer.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> while undobufferentries():\n", " | ... undo()\n", " | \n", " | write(self, arg, move=False, align='left', font=('Arial', 8, 'normal'))\n", " | Write text at the current turtle position.\n", " | \n", " | Arguments:\n", " | arg -- info, which is to be written to the TurtleScreen\n", " | move (optional) -- True/False\n", " | align (optional) -- one of the strings \"left\", \"center\" or right\"\n", " | font (optional) -- a triple (fontname, fontsize, fonttype)\n", " | \n", " | Write text - the string representation of arg - at the current\n", " | turtle position according to align (\"left\", \"center\" or right\")\n", " | and with the given font.\n", " | If move is True, the pen is moved to the bottom-right corner\n", " | of the text. By default, move is False.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.write('Home = ', True, align=\"center\")\n", " | >>> turtle.write((0,0), True)\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data and other attributes inherited from RawTurtle:\n", " | \n", " | screens = []\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from TPen:\n", " | \n", " | color(self, *args)\n", " | Return or set the pencolor and fillcolor.\n", " | \n", " | Arguments:\n", " | Several input formats are allowed.\n", " | They use 0, 1, 2, or 3 arguments as follows:\n", " | \n", " | color()\n", " | Return the current pencolor and the current fillcolor\n", " | as a pair of color specification strings as are returned\n", " | by pencolor and fillcolor.\n", " | color(colorstring), color((r,g,b)), color(r,g,b)\n", " | inputs as in pencolor, set both, fillcolor and pencolor,\n", " | to the given value.\n", " | color(colorstring1, colorstring2),\n", " | color((r1,g1,b1), (r2,g2,b2))\n", " | equivalent to pencolor(colorstring1) and fillcolor(colorstring2)\n", " | and analogously, if the other input format is used.\n", " | \n", " | If turtleshape is a polygon, outline and interior of that polygon\n", " | is drawn with the newly set colors.\n", " | For mor info see: pencolor, fillcolor\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.color('red', 'green')\n", " | >>> turtle.color()\n", " | ('red', 'green')\n", " | >>> colormode(255)\n", " | >>> color((40, 80, 120), (160, 200, 240))\n", " | >>> color()\n", " | ('#285078', '#a0c8f0')\n", " | \n", " | down = pendown(self)\n", " | Pull the pen down -- drawing when moving.\n", " | \n", " | Aliases: pendown | pd | down\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pendown()\n", " | \n", " | fillcolor(self, *args)\n", " | Return or set the fillcolor.\n", " | \n", " | Arguments:\n", " | Four input formats are allowed:\n", " | - fillcolor()\n", " | Return the current fillcolor as color specification string,\n", " | possibly in hex-number format (see example).\n", " | May be used as input to another color/pencolor/fillcolor call.\n", " | - fillcolor(colorstring)\n", " | s is a Tk color specification string, such as \"red\" or \"yellow\"\n", " | - fillcolor((r, g, b))\n", " | *a tuple* of r, g, and b, which represent, an RGB color,\n", " | and each of r, g, and b are in the range 0..colormode,\n", " | where colormode is either 1.0 or 255\n", " | - fillcolor(r, g, b)\n", " | r, g, and b represent an RGB color, and each of r, g, and b\n", " | are in the range 0..colormode\n", " | \n", " | If turtleshape is a polygon, the interior of that polygon is drawn\n", " | with the newly set fillcolor.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.fillcolor('violet')\n", " | >>> col = turtle.pencolor()\n", " | >>> turtle.fillcolor(col)\n", " | >>> turtle.fillcolor(0, .5, 0)\n", " | \n", " | hideturtle(self)\n", " | Makes the turtle invisible.\n", " | \n", " | Aliases: hideturtle | ht\n", " | \n", " | No argument.\n", " | \n", " | It's a good idea to do this while you're in the\n", " | middle of a complicated drawing, because hiding\n", " | the turtle speeds up the drawing observably.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | \n", " | ht = hideturtle(self)\n", " | Makes the turtle invisible.\n", " | \n", " | Aliases: hideturtle | ht\n", " | \n", " | No argument.\n", " | \n", " | It's a good idea to do this while you're in the\n", " | middle of a complicated drawing, because hiding\n", " | the turtle speeds up the drawing observably.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | \n", " | isdown(self)\n", " | Return True if pen is down, False if it's up.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | >>> turtle.isdown()\n", " | False\n", " | >>> turtle.pendown()\n", " | >>> turtle.isdown()\n", " | True\n", " | \n", " | isvisible(self)\n", " | Return True if the Turtle is shown, False if it's hidden.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | >>> print turtle.isvisible():\n", " | False\n", " | \n", " | pd = pendown(self)\n", " | Pull the pen down -- drawing when moving.\n", " | \n", " | Aliases: pendown | pd | down\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pendown()\n", " | \n", " | pen(self, pen=None, **pendict)\n", " | Return or set the pen's attributes.\n", " | \n", " | Arguments:\n", " | pen -- a dictionary with some or all of the below listed keys.\n", " | **pendict -- one or more keyword-arguments with the below\n", " | listed keys as keywords.\n", " | \n", " | Return or set the pen's attributes in a 'pen-dictionary'\n", " | with the following key/value pairs:\n", " | \"shown\" : True/False\n", " | \"pendown\" : True/False\n", " | \"pencolor\" : color-string or color-tuple\n", " | \"fillcolor\" : color-string or color-tuple\n", " | \"pensize\" : positive number\n", " | \"speed\" : number in range 0..10\n", " | \"resizemode\" : \"auto\" or \"user\" or \"noresize\"\n", " | \"stretchfactor\": (positive number, positive number)\n", " | \"shearfactor\": number\n", " | \"outline\" : positive number\n", " | \"tilt\" : number\n", " | \n", " | This dictionary can be used as argument for a subsequent\n", " | pen()-call to restore the former pen-state. Moreover one\n", " | or more of these attributes can be provided as keyword-arguments.\n", " | This can be used to set several pen attributes in one statement.\n", " | \n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n", " | >>> turtle.pen()\n", " | {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " | 'pencolor': 'red', 'pendown': True, 'fillcolor': 'black',\n", " | 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " | >>> penstate=turtle.pen()\n", " | >>> turtle.color(\"yellow\",\"\")\n", " | >>> turtle.penup()\n", " | >>> turtle.pen()\n", " | {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " | 'pencolor': 'yellow', 'pendown': False, 'fillcolor': '',\n", " | 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " | >>> p.pen(penstate, fillcolor=\"green\")\n", " | >>> p.pen()\n", " | {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " | 'pencolor': 'red', 'pendown': True, 'fillcolor': 'green',\n", " | 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " | \n", " | pencolor(self, *args)\n", " | Return or set the pencolor.\n", " | \n", " | Arguments:\n", " | Four input formats are allowed:\n", " | - pencolor()\n", " | Return the current pencolor as color specification string,\n", " | possibly in hex-number format (see example).\n", " | May be used as input to another color/pencolor/fillcolor call.\n", " | - pencolor(colorstring)\n", " | s is a Tk color specification string, such as \"red\" or \"yellow\"\n", " | - pencolor((r, g, b))\n", " | *a tuple* of r, g, and b, which represent, an RGB color,\n", " | and each of r, g, and b are in the range 0..colormode,\n", " | where colormode is either 1.0 or 255\n", " | - pencolor(r, g, b)\n", " | r, g, and b represent an RGB color, and each of r, g, and b\n", " | are in the range 0..colormode\n", " | \n", " | If turtleshape is a polygon, the outline of that polygon is drawn\n", " | with the newly set pencolor.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pencolor('brown')\n", " | >>> tup = (0.2, 0.8, 0.55)\n", " | >>> turtle.pencolor(tup)\n", " | >>> turtle.pencolor()\n", " | '#33cc8c'\n", " | \n", " | pendown(self)\n", " | Pull the pen down -- drawing when moving.\n", " | \n", " | Aliases: pendown | pd | down\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pendown()\n", " | \n", " | pensize(self, width=None)\n", " | Set or return the line thickness.\n", " | \n", " | Aliases: pensize | width\n", " | \n", " | Argument:\n", " | width -- positive number\n", " | \n", " | Set the line thickness to width or return it. If resizemode is set\n", " | to \"auto\" and turtleshape is a polygon, that polygon is drawn with\n", " | the same line thickness. If no argument is given, current pensize\n", " | is returned.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pensize()\n", " | 1\n", " | >>> turtle.pensize(10) # from here on lines of width 10 are drawn\n", " | \n", " | penup(self)\n", " | Pull the pen up -- no drawing when moving.\n", " | \n", " | Aliases: penup | pu | up\n", " | \n", " | No argument\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | \n", " | pu = penup(self)\n", " | Pull the pen up -- no drawing when moving.\n", " | \n", " | Aliases: penup | pu | up\n", " | \n", " | No argument\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | \n", " | resizemode(self, rmode=None)\n", " | Set resizemode to one of the values: \"auto\", \"user\", \"noresize\".\n", " | \n", " | (Optional) Argument:\n", " | rmode -- one of the strings \"auto\", \"user\", \"noresize\"\n", " | \n", " | Different resizemodes have the following effects:\n", " | - \"auto\" adapts the appearance of the turtle\n", " | corresponding to the value of pensize.\n", " | - \"user\" adapts the appearance of the turtle according to the\n", " | values of stretchfactor and outlinewidth (outline),\n", " | which are set by shapesize()\n", " | - \"noresize\" no adaption of the turtle's appearance takes place.\n", " | If no argument is given, return current resizemode.\n", " | resizemode(\"user\") is called by a call of shapesize with arguments.\n", " | \n", " | \n", " | Examples (for a Turtle instance named turtle):\n", " | >>> turtle.resizemode(\"noresize\")\n", " | >>> turtle.resizemode()\n", " | 'noresize'\n", " | \n", " | showturtle(self)\n", " | Makes the turtle visible.\n", " | \n", " | Aliases: showturtle | st\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | >>> turtle.showturtle()\n", " | \n", " | speed(self, speed=None)\n", " | Return or set the turtle's speed.\n", " | \n", " | Optional argument:\n", " | speed -- an integer in the range 0..10 or a speedstring (see below)\n", " | \n", " | Set the turtle's speed to an integer value in the range 0 .. 10.\n", " | If no argument is given: return current speed.\n", " | \n", " | If input is a number greater than 10 or smaller than 0.5,\n", " | speed is set to 0.\n", " | Speedstrings are mapped to speedvalues in the following way:\n", " | 'fastest' : 0\n", " | 'fast' : 10\n", " | 'normal' : 6\n", " | 'slow' : 3\n", " | 'slowest' : 1\n", " | speeds from 1 to 10 enforce increasingly faster animation of\n", " | line drawing and turtle turning.\n", " | \n", " | Attention:\n", " | speed = 0 : *no* animation takes place. forward/back makes turtle jump\n", " | and likewise left/right make the turtle turn instantly.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.speed(3)\n", " | \n", " | st = showturtle(self)\n", " | Makes the turtle visible.\n", " | \n", " | Aliases: showturtle | st\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.hideturtle()\n", " | >>> turtle.showturtle()\n", " | \n", " | up = penup(self)\n", " | Pull the pen up -- no drawing when moving.\n", " | \n", " | Aliases: penup | pu | up\n", " | \n", " | No argument\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.penup()\n", " | \n", " | width = pensize(self, width=None)\n", " | Set or return the line thickness.\n", " | \n", " | Aliases: pensize | width\n", " | \n", " | Argument:\n", " | width -- positive number\n", " | \n", " | Set the line thickness to width or return it. If resizemode is set\n", " | to \"auto\" and turtleshape is a polygon, that polygon is drawn with\n", " | the same line thickness. If no argument is given, current pensize\n", " | is returned.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pensize()\n", " | 1\n", " | >>> turtle.pensize(10) # from here on lines of width 10 are drawn\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data descriptors inherited from TPen:\n", " | \n", " | __dict__\n", " | dictionary for instance variables (if defined)\n", " | \n", " | __weakref__\n", " | list of weak references to the object (if defined)\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from TNavigator:\n", " | \n", " | back(self, distance)\n", " | Move the turtle backward by distance.\n", " | \n", " | Aliases: back | backward | bk\n", " | \n", " | Argument:\n", " | distance -- a number\n", " | \n", " | Move the turtle backward by distance ,opposite to the direction the\n", " | turtle is headed. Do not change the turtle's heading.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.backward(30)\n", " | >>> turtle.position()\n", " | (-30.00, 0.00)\n", " | \n", " | backward = back(self, distance)\n", " | Move the turtle backward by distance.\n", " | \n", " | Aliases: back | backward | bk\n", " | \n", " | Argument:\n", " | distance -- a number\n", " | \n", " | Move the turtle backward by distance ,opposite to the direction the\n", " | turtle is headed. Do not change the turtle's heading.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.backward(30)\n", " | >>> turtle.position()\n", " | (-30.00, 0.00)\n", " | \n", " | bk = back(self, distance)\n", " | Move the turtle backward by distance.\n", " | \n", " | Aliases: back | backward | bk\n", " | \n", " | Argument:\n", " | distance -- a number\n", " | \n", " | Move the turtle backward by distance ,opposite to the direction the\n", " | turtle is headed. Do not change the turtle's heading.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.backward(30)\n", " | >>> turtle.position()\n", " | (-30.00, 0.00)\n", " | \n", " | circle(self, radius, extent=None, steps=None)\n", " | Draw a circle with given radius.\n", " | \n", " | Arguments:\n", " | radius -- a number\n", " | extent (optional) -- a number\n", " | steps (optional) -- an integer\n", " | \n", " | Draw a circle with given radius. The center is radius units left\n", " | of the turtle; extent - an angle - determines which part of the\n", " | circle is drawn. If extent is not given, draw the entire circle.\n", " | If extent is not a full circle, one endpoint of the arc is the\n", " | current pen position. Draw the arc in counterclockwise direction\n", " | if radius is positive, otherwise in clockwise direction. Finally\n", " | the direction of the turtle is changed by the amount of extent.\n", " | \n", " | As the circle is approximated by an inscribed regular polygon,\n", " | steps determines the number of steps to use. If not given,\n", " | it will be calculated automatically. Maybe used to draw regular\n", " | polygons.\n", " | \n", " | call: circle(radius) # full circle\n", " | --or: circle(radius, extent) # arc\n", " | --or: circle(radius, extent, steps)\n", " | --or: circle(radius, steps=6) # 6-sided polygon\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.circle(50)\n", " | >>> turtle.circle(120, 180) # semicircle\n", " | \n", " | degrees(self, fullcircle=360.0)\n", " | Set angle measurement units to degrees.\n", " | \n", " | Optional argument:\n", " | fullcircle - a number\n", " | \n", " | Set angle measurement units, i. e. set number\n", " | of 'degrees' for a full circle. Dafault value is\n", " | 360 degrees.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.left(90)\n", " | >>> turtle.heading()\n", " | 90\n", " | \n", " | Change angle measurement unit to grad (also known as gon,\n", " | grade, or gradian and equals 1/100-th of the right angle.)\n", " | >>> turtle.degrees(400.0)\n", " | >>> turtle.heading()\n", " | 100\n", " | \n", " | distance(self, x, y=None)\n", " | Return the distance from the turtle to (x,y) in turtle step units.\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers or a turtle instance\n", " | y -- a number None None\n", " | \n", " | call: distance(x, y) # two coordinates\n", " | --or: distance((x, y)) # a pair (tuple) of coordinates\n", " | --or: distance(vec) # e.g. as returned by pos()\n", " | --or: distance(mypen) # where mypen is another turtle\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (0.00, 0.00)\n", " | >>> turtle.distance(30,40)\n", " | 50.0\n", " | >>> pen = Turtle()\n", " | >>> pen.forward(77)\n", " | >>> turtle.distance(pen)\n", " | 77.0\n", " | \n", " | fd = forward(self, distance)\n", " | Move the turtle forward by the specified distance.\n", " | \n", " | Aliases: forward | fd\n", " | \n", " | Argument:\n", " | distance -- a number (integer or float)\n", " | \n", " | Move the turtle forward by the specified distance, in the direction\n", " | the turtle is headed.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.forward(25)\n", " | >>> turtle.position()\n", " | (25.00,0.00)\n", " | >>> turtle.forward(-75)\n", " | >>> turtle.position()\n", " | (-50.00,0.00)\n", " | \n", " | forward(self, distance)\n", " | Move the turtle forward by the specified distance.\n", " | \n", " | Aliases: forward | fd\n", " | \n", " | Argument:\n", " | distance -- a number (integer or float)\n", " | \n", " | Move the turtle forward by the specified distance, in the direction\n", " | the turtle is headed.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 0.00)\n", " | >>> turtle.forward(25)\n", " | >>> turtle.position()\n", " | (25.00,0.00)\n", " | >>> turtle.forward(-75)\n", " | >>> turtle.position()\n", " | (-50.00,0.00)\n", " | \n", " | goto(self, x, y=None)\n", " | Move turtle to an absolute position.\n", " | \n", " | Aliases: setpos | setposition | goto:\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers\n", " | y -- a number None\n", " | \n", " | call: goto(x, y) # two coordinates\n", " | --or: goto((x, y)) # a pair (tuple) of coordinates\n", " | --or: goto(vec) # e.g. as returned by pos()\n", " | \n", " | Move turtle to an absolute position. If the pen is down,\n", " | a line will be drawn. The turtle's orientation does not change.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> tp = turtle.pos()\n", " | >>> tp\n", " | (0.00, 0.00)\n", " | >>> turtle.setpos(60,30)\n", " | >>> turtle.pos()\n", " | (60.00,30.00)\n", " | >>> turtle.setpos((20,80))\n", " | >>> turtle.pos()\n", " | (20.00,80.00)\n", " | >>> turtle.setpos(tp)\n", " | >>> turtle.pos()\n", " | (0.00,0.00)\n", " | \n", " | heading(self)\n", " | Return the turtle's current heading.\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.left(67)\n", " | >>> turtle.heading()\n", " | 67.0\n", " | \n", " | home(self)\n", " | Move turtle to the origin - coordinates (0,0).\n", " | \n", " | No arguments.\n", " | \n", " | Move turtle to the origin - coordinates (0,0) and set its\n", " | heading to its start-orientation (which depends on mode).\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.home()\n", " | \n", " | left(self, angle)\n", " | Turn turtle left by angle units.\n", " | \n", " | Aliases: left | lt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle left by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.left(45)\n", " | >>> turtle.heading()\n", " | 67.0\n", " | \n", " | lt = left(self, angle)\n", " | Turn turtle left by angle units.\n", " | \n", " | Aliases: left | lt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle left by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.left(45)\n", " | >>> turtle.heading()\n", " | 67.0\n", " | \n", " | pos(self)\n", " | Return the turtle's current location (x,y), as a Vec2D-vector.\n", " | \n", " | Aliases: pos | position\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (0.00, 240.00)\n", " | \n", " | position = pos(self)\n", " | Return the turtle's current location (x,y), as a Vec2D-vector.\n", " | \n", " | Aliases: pos | position\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (0.00, 240.00)\n", " | \n", " | radians(self)\n", " | Set the angle measurement units to radians.\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 90\n", " | >>> turtle.radians()\n", " | >>> turtle.heading()\n", " | 1.5707963267948966\n", " | \n", " | right(self, angle)\n", " | Turn turtle right by angle units.\n", " | \n", " | Aliases: right | rt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle right by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.right(45)\n", " | >>> turtle.heading()\n", " | 337.0\n", " | \n", " | rt = right(self, angle)\n", " | Turn turtle right by angle units.\n", " | \n", " | Aliases: right | rt\n", " | \n", " | Argument:\n", " | angle -- a number (integer or float)\n", " | \n", " | Turn turtle right by angle units. (Units are by default degrees,\n", " | but can be set via the degrees() and radians() functions.)\n", " | Angle orientation depends on mode. (See this.)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.heading()\n", " | 22.0\n", " | >>> turtle.right(45)\n", " | >>> turtle.heading()\n", " | 337.0\n", " | \n", " | seth = setheading(self, to_angle)\n", " | Set the orientation of the turtle to to_angle.\n", " | \n", " | Aliases: setheading | seth\n", " | \n", " | Argument:\n", " | to_angle -- a number (integer or float)\n", " | \n", " | Set the orientation of the turtle to to_angle.\n", " | Here are some common directions in degrees:\n", " | \n", " | standard - mode: logo-mode:\n", " | -------------------|--------------------\n", " | 0 - east 0 - north\n", " | 90 - north 90 - east\n", " | 180 - west 180 - south\n", " | 270 - south 270 - west\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.setheading(90)\n", " | >>> turtle.heading()\n", " | 90\n", " | \n", " | setheading(self, to_angle)\n", " | Set the orientation of the turtle to to_angle.\n", " | \n", " | Aliases: setheading | seth\n", " | \n", " | Argument:\n", " | to_angle -- a number (integer or float)\n", " | \n", " | Set the orientation of the turtle to to_angle.\n", " | Here are some common directions in degrees:\n", " | \n", " | standard - mode: logo-mode:\n", " | -------------------|--------------------\n", " | 0 - east 0 - north\n", " | 90 - north 90 - east\n", " | 180 - west 180 - south\n", " | 270 - south 270 - west\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.setheading(90)\n", " | >>> turtle.heading()\n", " | 90\n", " | \n", " | setpos = goto(self, x, y=None)\n", " | Move turtle to an absolute position.\n", " | \n", " | Aliases: setpos | setposition | goto:\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers\n", " | y -- a number None\n", " | \n", " | call: goto(x, y) # two coordinates\n", " | --or: goto((x, y)) # a pair (tuple) of coordinates\n", " | --or: goto(vec) # e.g. as returned by pos()\n", " | \n", " | Move turtle to an absolute position. If the pen is down,\n", " | a line will be drawn. The turtle's orientation does not change.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> tp = turtle.pos()\n", " | >>> tp\n", " | (0.00, 0.00)\n", " | >>> turtle.setpos(60,30)\n", " | >>> turtle.pos()\n", " | (60.00,30.00)\n", " | >>> turtle.setpos((20,80))\n", " | >>> turtle.pos()\n", " | (20.00,80.00)\n", " | >>> turtle.setpos(tp)\n", " | >>> turtle.pos()\n", " | (0.00,0.00)\n", " | \n", " | setposition = goto(self, x, y=None)\n", " | Move turtle to an absolute position.\n", " | \n", " | Aliases: setpos | setposition | goto:\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers\n", " | y -- a number None\n", " | \n", " | call: goto(x, y) # two coordinates\n", " | --or: goto((x, y)) # a pair (tuple) of coordinates\n", " | --or: goto(vec) # e.g. as returned by pos()\n", " | \n", " | Move turtle to an absolute position. If the pen is down,\n", " | a line will be drawn. The turtle's orientation does not change.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> tp = turtle.pos()\n", " | >>> tp\n", " | (0.00, 0.00)\n", " | >>> turtle.setpos(60,30)\n", " | >>> turtle.pos()\n", " | (60.00,30.00)\n", " | >>> turtle.setpos((20,80))\n", " | >>> turtle.pos()\n", " | (20.00,80.00)\n", " | >>> turtle.setpos(tp)\n", " | >>> turtle.pos()\n", " | (0.00,0.00)\n", " | \n", " | setx(self, x)\n", " | Set the turtle's first coordinate to x\n", " | \n", " | Argument:\n", " | x -- a number (integer or float)\n", " | \n", " | Set the turtle's first coordinate to x, leave second coordinate\n", " | unchanged.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 240.00)\n", " | >>> turtle.setx(10)\n", " | >>> turtle.position()\n", " | (10.00, 240.00)\n", " | \n", " | sety(self, y)\n", " | Set the turtle's second coordinate to y\n", " | \n", " | Argument:\n", " | y -- a number (integer or float)\n", " | \n", " | Set the turtle's first coordinate to x, second coordinate remains\n", " | unchanged.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.position()\n", " | (0.00, 40.00)\n", " | >>> turtle.sety(-10)\n", " | >>> turtle.position()\n", " | (0.00, -10.00)\n", " | \n", " | towards(self, x, y=None)\n", " | Return the angle of the line from the turtle's position to (x, y).\n", " | \n", " | Arguments:\n", " | x -- a number or a pair/vector of numbers or a turtle instance\n", " | y -- a number None None\n", " | \n", " | call: distance(x, y) # two coordinates\n", " | --or: distance((x, y)) # a pair (tuple) of coordinates\n", " | --or: distance(vec) # e.g. as returned by pos()\n", " | --or: distance(mypen) # where mypen is another turtle\n", " | \n", " | Return the angle, between the line from turtle-position to position\n", " | specified by x, y and the turtle's start orientation. (Depends on\n", " | modes - \"standard\" or \"logo\")\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.pos()\n", " | (10.00, 10.00)\n", " | >>> turtle.towards(0,0)\n", " | 225.0\n", " | \n", " | xcor(self)\n", " | Return the turtle's x coordinate.\n", " | \n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> reset()\n", " | >>> turtle.left(60)\n", " | >>> turtle.forward(100)\n", " | >>> print turtle.xcor()\n", " | 50.0\n", " | \n", " | ycor(self)\n", " | Return the turtle's y coordinate\n", " | ---\n", " | No arguments.\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> reset()\n", " | >>> turtle.left(60)\n", " | >>> turtle.forward(100)\n", " | >>> print turtle.ycor()\n", " | 86.6025403784\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data and other attributes inherited from TNavigator:\n", " | \n", " | DEFAULT_ANGLEOFFSET = 0\n", " | \n", " | DEFAULT_ANGLEORIENT = 1\n", " | \n", " | DEFAULT_MODE = 'standard'\n", " | \n", " | START_ORIENTATION = {'logo': (0.00,1.00), 'standard': (1.00,0.00), 'wo...\n", " \n", " class TurtleScreen(TurtleScreenBase)\n", " | Provides screen oriented methods like setbg etc.\n", " | \n", " | Only relies upon the methods of TurtleScreenBase and NOT\n", " | upon components of the underlying graphics toolkit -\n", " | which is Tkinter in this case.\n", " | \n", " | Method resolution order:\n", " | TurtleScreen\n", " | TurtleScreenBase\n", " | builtins.object\n", " | \n", " | Methods defined here:\n", " | \n", " | __init__(self, cv, mode='standard', colormode=1.0, delay=10)\n", " | Initialize self. See help(type(self)) for accurate signature.\n", " | \n", " | addshape = register_shape(self, name, shape=None)\n", " | \n", " | bgcolor(self, *args)\n", " | Set or return backgroundcolor of the TurtleScreen.\n", " | \n", " | Arguments (if given): a color string or three numbers\n", " | in the range 0..colormode or a 3-tuple of such numbers.\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.bgcolor(\"orange\")\n", " | >>> screen.bgcolor()\n", " | 'orange'\n", " | >>> screen.bgcolor(0.5,0,0.5)\n", " | >>> screen.bgcolor()\n", " | '#800080'\n", " | \n", " | bgpic(self, picname=None)\n", " | Set background image or return name of current backgroundimage.\n", " | \n", " | Optional argument:\n", " | picname -- a string, name of a gif-file or \"nopic\".\n", " | \n", " | If picname is a filename, set the corresponding image as background.\n", " | If picname is \"nopic\", delete backgroundimage, if present.\n", " | If picname is None, return the filename of the current backgroundimage.\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.bgpic()\n", " | 'nopic'\n", " | >>> screen.bgpic(\"landscape.gif\")\n", " | >>> screen.bgpic()\n", " | 'landscape.gif'\n", " | \n", " | clear(self)\n", " | Delete all drawings and all turtles from the TurtleScreen.\n", " | \n", " | No argument.\n", " | \n", " | Reset empty TurtleScreen to its initial state: white background,\n", " | no backgroundimage, no eventbindings and tracing on.\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.clear()\n", " | \n", " | Note: this method is not available as function.\n", " | \n", " | clearscreen = clear(self)\n", " | \n", " | colormode(self, cmode=None)\n", " | Return the colormode or set it to 1.0 or 255.\n", " | \n", " | Optional argument:\n", " | cmode -- one of the values 1.0 or 255\n", " | \n", " | r, g, b values of colortriples have to be in range 0..cmode.\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.colormode()\n", " | 1.0\n", " | >>> screen.colormode(255)\n", " | >>> pencolor(240,160,80)\n", " | \n", " | delay(self, delay=None)\n", " | Return or set the drawing delay in milliseconds.\n", " | \n", " | Optional argument:\n", " | delay -- positive integer\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.delay(15)\n", " | >>> screen.delay()\n", " | 15\n", " | \n", " | getcanvas(self)\n", " | Return the Canvas of this TurtleScreen.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a Screen instance named screen):\n", " | >>> cv = screen.getcanvas()\n", " | >>> cv\n", " | \n", " | \n", " | getshapes(self)\n", " | Return a list of names of all currently available turtle shapes.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.getshapes()\n", " | ['arrow', 'blank', 'circle', ... , 'turtle']\n", " | \n", " | listen(self, xdummy=None, ydummy=None)\n", " | Set focus on TurtleScreen (in order to collect key-events)\n", " | \n", " | No arguments.\n", " | Dummy arguments are provided in order\n", " | to be able to pass listen to the onclick method.\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.listen()\n", " | \n", " | mode(self, mode=None)\n", " | Set turtle-mode ('standard', 'logo' or 'world') and perform reset.\n", " | \n", " | Optional argument:\n", " | mode -- one of the strings 'standard', 'logo' or 'world'\n", " | \n", " | Mode 'standard' is compatible with turtle.py.\n", " | Mode 'logo' is compatible with most Logo-Turtle-Graphics.\n", " | Mode 'world' uses userdefined 'worldcoordinates'. *Attention*: in\n", " | this mode angles appear distorted if x/y unit-ratio doesn't equal 1.\n", " | If mode is not given, return the current mode.\n", " | \n", " | Mode Initial turtle heading positive angles\n", " | ------------|-------------------------|-------------------\n", " | 'standard' to the right (east) counterclockwise\n", " | 'logo' upward (north) clockwise\n", " | \n", " | Examples:\n", " | >>> mode('logo') # resets turtle heading to north\n", " | >>> mode()\n", " | 'logo'\n", " | \n", " | onclick(self, fun, btn=1, add=None)\n", " | Bind fun to mouse-click event on canvas.\n", " | \n", " | Arguments:\n", " | fun -- a function with two arguments, the coordinates of the\n", " | clicked point on the canvas.\n", " | num -- the number of the mouse-button, defaults to 1\n", " | \n", " | Example (for a TurtleScreen instance named screen)\n", " | \n", " | >>> screen.onclick(goto)\n", " | >>> # Subsequently clicking into the TurtleScreen will\n", " | >>> # make the turtle move to the clicked point.\n", " | >>> screen.onclick(None)\n", " | \n", " | onkey(self, fun, key)\n", " | Bind fun to key-release event of key.\n", " | \n", " | Arguments:\n", " | fun -- a function with no arguments\n", " | key -- a string: key (e.g. \"a\") or key-symbol (e.g. \"space\")\n", " | \n", " | In order to be able to register key-events, TurtleScreen\n", " | must have focus. (See method listen.)\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | \n", " | >>> def f():\n", " | ... fd(50)\n", " | ... lt(60)\n", " | ...\n", " | >>> screen.onkey(f, \"Up\")\n", " | >>> screen.listen()\n", " | \n", " | Subsequently the turtle can be moved by repeatedly pressing\n", " | the up-arrow key, consequently drawing a hexagon\n", " | \n", " | onkeypress(self, fun, key=None)\n", " | Bind fun to key-press event of key if key is given,\n", " | or to any key-press-event if no key is given.\n", " | \n", " | Arguments:\n", " | fun -- a function with no arguments\n", " | key -- a string: key (e.g. \"a\") or key-symbol (e.g. \"space\")\n", " | \n", " | In order to be able to register key-events, TurtleScreen\n", " | must have focus. (See method listen.)\n", " | \n", " | Example (for a TurtleScreen instance named screen\n", " | and a Turtle instance named turtle):\n", " | \n", " | >>> def f():\n", " | ... fd(50)\n", " | ... lt(60)\n", " | ...\n", " | >>> screen.onkeypress(f, \"Up\")\n", " | >>> screen.listen()\n", " | \n", " | Subsequently the turtle can be moved by repeatedly pressing\n", " | the up-arrow key, or by keeping pressed the up-arrow key.\n", " | consequently drawing a hexagon.\n", " | \n", " | onkeyrelease = onkey(self, fun, key)\n", " | \n", " | onscreenclick = onclick(self, fun, btn=1, add=None)\n", " | \n", " | ontimer(self, fun, t=0)\n", " | Install a timer, which calls fun after t milliseconds.\n", " | \n", " | Arguments:\n", " | fun -- a function with no arguments.\n", " | t -- a number >= 0\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | \n", " | >>> running = True\n", " | >>> def f():\n", " | ... if running:\n", " | ... fd(50)\n", " | ... lt(60)\n", " | ... screen.ontimer(f, 250)\n", " | ...\n", " | >>> f() # makes the turtle marching around\n", " | >>> running = False\n", " | \n", " | register_shape(self, name, shape=None)\n", " | Adds a turtle shape to TurtleScreen's shapelist.\n", " | \n", " | Arguments:\n", " | (1) name is the name of a gif-file and shape is None.\n", " | Installs the corresponding image shape.\n", " | !! Image-shapes DO NOT rotate when turning the turtle,\n", " | !! so they do not display the heading of the turtle!\n", " | (2) name is an arbitrary string and shape is a tuple\n", " | of pairs of coordinates. Installs the corresponding\n", " | polygon shape\n", " | (3) name is an arbitrary string and shape is a\n", " | (compound) Shape object. Installs the corresponding\n", " | compound shape.\n", " | To use a shape, you have to issue the command shape(shapename).\n", " | \n", " | call: register_shape(\"turtle.gif\")\n", " | --or: register_shape(\"tri\", ((0,0), (10,10), (-10,10)))\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.register_shape(\"triangle\", ((5,-3),(0,5),(-5,-3)))\n", " | \n", " | reset(self)\n", " | Reset all Turtles on the Screen to their initial state.\n", " | \n", " | No argument.\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.reset()\n", " | \n", " | resetscreen = reset(self)\n", " | \n", " | screensize(self, canvwidth=None, canvheight=None, bg=None)\n", " | Resize the canvas the turtles are drawing on.\n", " | \n", " | Optional arguments:\n", " | canvwidth -- positive integer, new width of canvas in pixels\n", " | canvheight -- positive integer, new height of canvas in pixels\n", " | bg -- colorstring or color-tuple, new backgroundcolor\n", " | If no arguments are given, return current (canvaswidth, canvasheight)\n", " | \n", " | Do not alter the drawing window. To observe hidden parts of\n", " | the canvas use the scrollbars. (Can make visible those parts\n", " | of a drawing, which were outside the canvas before!)\n", " | \n", " | Example (for a Turtle instance named turtle):\n", " | >>> turtle.screensize(2000,1500)\n", " | >>> # e.g. to search for an erroneously escaped turtle ;-)\n", " | \n", " | setworldcoordinates(self, llx, lly, urx, ury)\n", " | Set up a user defined coordinate-system.\n", " | \n", " | Arguments:\n", " | llx -- a number, x-coordinate of lower left corner of canvas\n", " | lly -- a number, y-coordinate of lower left corner of canvas\n", " | urx -- a number, x-coordinate of upper right corner of canvas\n", " | ury -- a number, y-coordinate of upper right corner of canvas\n", " | \n", " | Set up user coodinat-system and switch to mode 'world' if necessary.\n", " | This performs a screen.reset. If mode 'world' is already active,\n", " | all drawings are redrawn according to the new coordinates.\n", " | \n", " | But ATTENTION: in user-defined coordinatesystems angles may appear\n", " | distorted. (see Screen.mode())\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.setworldcoordinates(-10,-0.5,50,1.5)\n", " | >>> for _ in range(36):\n", " | ... left(10)\n", " | ... forward(0.5)\n", " | \n", " | tracer(self, n=None, delay=None)\n", " | Turns turtle animation on/off and set delay for update drawings.\n", " | \n", " | Optional arguments:\n", " | n -- nonnegative integer\n", " | delay -- nonnegative integer\n", " | \n", " | If n is given, only each n-th regular screen update is really performed.\n", " | (Can be used to accelerate the drawing of complex graphics.)\n", " | Second arguments sets delay value (see RawTurtle.delay())\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.tracer(8, 25)\n", " | >>> dist = 2\n", " | >>> for i in range(200):\n", " | ... fd(dist)\n", " | ... rt(90)\n", " | ... dist += 2\n", " | \n", " | turtles(self)\n", " | Return the list of turtles on the screen.\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.turtles()\n", " | []\n", " | \n", " | update(self)\n", " | Perform a TurtleScreen update.\n", " | \n", " | window_height(self)\n", " | Return the height of the turtle window.\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.window_height()\n", " | 480\n", " | \n", " | window_width(self)\n", " | Return the width of the turtle window.\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.window_width()\n", " | 640\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from TurtleScreenBase:\n", " | \n", " | mainloop(self)\n", " | Starts event loop - calling Tkinter's mainloop function.\n", " | \n", " | No argument.\n", " | \n", " | Must be last statement in a turtle graphics program.\n", " | Must NOT be used if a script is run from within IDLE in -n mode\n", " | (No subprocess) - for interactive use of turtle graphics.\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.mainloop()\n", " | \n", " | numinput(self, title, prompt, default=None, minval=None, maxval=None)\n", " | Pop up a dialog window for input of a number.\n", " | \n", " | Arguments: title is the title of the dialog window,\n", " | prompt is a text mostly describing what numerical information to input.\n", " | default: default value\n", " | minval: minimum value for imput\n", " | maxval: maximum value for input\n", " | \n", " | The number input must be in the range minval .. maxval if these are\n", " | given. If not, a hint is issued and the dialog remains open for\n", " | correction. Return the number input.\n", " | If the dialog is canceled, return None.\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, maxval=10000)\n", " | \n", " | textinput(self, title, prompt)\n", " | Pop up a dialog window for input of a string.\n", " | \n", " | Arguments: title is the title of the dialog window,\n", " | prompt is a text mostly describing what information to input.\n", " | \n", " | Return the string input\n", " | If the dialog is canceled, return None.\n", " | \n", " | Example (for a TurtleScreen instance named screen):\n", " | >>> screen.textinput(\"NIM\", \"Name of first player:\")\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data descriptors inherited from TurtleScreenBase:\n", " | \n", " | __dict__\n", " | dictionary for instance variables (if defined)\n", " | \n", " | __weakref__\n", " | list of weak references to the object (if defined)\n", " \n", " class Vec2D(builtins.tuple)\n", " | A 2 dimensional vector class, used as a helper class\n", " | for implementing turtle graphics.\n", " | May be useful for turtle graphics programs also.\n", " | Derived from tuple, so a vector is a tuple!\n", " | \n", " | Provides (for a, b vectors, k number):\n", " | a+b vector addition\n", " | a-b vector subtraction\n", " | a*b inner product\n", " | k*a and a*k multiplication with scalar\n", " | |a| absolute value of a\n", " | a.rotate(angle) rotation\n", " | \n", " | Method resolution order:\n", " | Vec2D\n", " | builtins.tuple\n", " | builtins.object\n", " | \n", " | Methods defined here:\n", " | \n", " | __abs__(self)\n", " | \n", " | __add__(self, other)\n", " | Return self+value.\n", " | \n", " | __getnewargs__(self)\n", " | \n", " | __mul__(self, other)\n", " | Return self*value.n\n", " | \n", " | __neg__(self)\n", " | \n", " | __repr__(self)\n", " | Return repr(self).\n", " | \n", " | __rmul__(self, other)\n", " | Return self*value.\n", " | \n", " | __sub__(self, other)\n", " | \n", " | rotate(self, angle)\n", " | rotate self counterclockwise by angle\n", " | \n", " | ----------------------------------------------------------------------\n", " | Static methods defined here:\n", " | \n", " | __new__(cls, x, y)\n", " | Create and return a new object. See help(type) for accurate signature.\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data descriptors defined here:\n", " | \n", " | __dict__\n", " | dictionary for instance variables (if defined)\n", " | \n", " | ----------------------------------------------------------------------\n", " | Methods inherited from builtins.tuple:\n", " | \n", " | __contains__(self, key, /)\n", " | Return key in self.\n", " | \n", " | __eq__(self, value, /)\n", " | Return self==value.\n", " | \n", " | __ge__(self, value, /)\n", " | Return self>=value.\n", " | \n", " | __getattribute__(self, name, /)\n", " | Return getattr(self, name).\n", " | \n", " | __getitem__(self, key, /)\n", " | Return self[key].\n", " | \n", " | __gt__(self, value, /)\n", " | Return self>value.\n", " | \n", " | __hash__(self, /)\n", " | Return hash(self).\n", " | \n", " | __iter__(self, /)\n", " | Implement iter(self).\n", " | \n", " | __le__(self, value, /)\n", " | Return self<=value.\n", " | \n", " | __len__(self, /)\n", " | Return len(self).\n", " | \n", " | __lt__(self, value, /)\n", " | Return self integer -- return number of occurrences of value\n", " | \n", " | index(...)\n", " | T.index(value, [start, [stop]]) -> integer -- return first index of value.\n", " | Raises ValueError if the value is not present.\n", "\n", "FUNCTIONS\n", " Screen()\n", " Return the singleton screen object.\n", " If none exists at the moment, create a new one and return it,\n", " else return the existing one.\n", " \n", " addshape(name, shape=None)\n", " Adds a turtle shape to TurtleScreen's shapelist.\n", " \n", " Arguments:\n", " (1) name is the name of a gif-file and shape is None.\n", " Installs the corresponding image shape.\n", " !! Image-shapes DO NOT rotate when turning the turtle,\n", " !! so they do not display the heading of the turtle!\n", " (2) name is an arbitrary string and shape is a tuple\n", " of pairs of coordinates. Installs the corresponding\n", " polygon shape\n", " (3) name is an arbitrary string and shape is a\n", " (compound) Shape object. Installs the corresponding\n", " compound shape.\n", " To use a shape, you have to issue the command shape(shapename).\n", " \n", " call: register_shape(\"turtle.gif\")\n", " --or: register_shape(\"tri\", ((0,0), (10,10), (-10,10)))\n", " \n", " Example:\n", " >>> register_shape(\"triangle\", ((5,-3),(0,5),(-5,-3)))\n", " \n", " back(distance)\n", " Move the turtle backward by distance.\n", " \n", " Aliases: back | backward | bk\n", " \n", " Argument:\n", " distance -- a number\n", " \n", " Move the turtle backward by distance ,opposite to the direction the\n", " turtle is headed. Do not change the turtle's heading.\n", " \n", " Example:\n", " >>> position()\n", " (0.00, 0.00)\n", " >>> backward(30)\n", " >>> position()\n", " (-30.00, 0.00)\n", " \n", " backward(distance)\n", " Move the turtle backward by distance.\n", " \n", " Aliases: back | backward | bk\n", " \n", " Argument:\n", " distance -- a number\n", " \n", " Move the turtle backward by distance ,opposite to the direction the\n", " turtle is headed. Do not change the turtle's heading.\n", " \n", " Example:\n", " >>> position()\n", " (0.00, 0.00)\n", " >>> backward(30)\n", " >>> position()\n", " (-30.00, 0.00)\n", " \n", " begin_fill()\n", " Called just before drawing a shape to be filled.\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> color(\"black\", \"red\")\n", " >>> begin_fill()\n", " >>> circle(60)\n", " >>> end_fill()\n", " \n", " begin_poly()\n", " Start recording the vertices of a polygon.\n", " \n", " No argument.\n", " \n", " Start recording the vertices of a polygon. Current turtle position\n", " is first point of polygon.\n", " \n", " Example:\n", " >>> begin_poly()\n", " \n", " bgcolor(*args)\n", " Set or return backgroundcolor of the TurtleScreen.\n", " \n", " Arguments (if given): a color string or three numbers\n", " in the range 0..colormode or a 3-tuple of such numbers.\n", " \n", " Example:\n", " >>> bgcolor(\"orange\")\n", " >>> bgcolor()\n", " 'orange'\n", " >>> bgcolor(0.5,0,0.5)\n", " >>> bgcolor()\n", " '#800080'\n", " \n", " bgpic(picname=None)\n", " Set background image or return name of current backgroundimage.\n", " \n", " Optional argument:\n", " picname -- a string, name of a gif-file or \"nopic\".\n", " \n", " If picname is a filename, set the corresponding image as background.\n", " If picname is \"nopic\", delete backgroundimage, if present.\n", " If picname is None, return the filename of the current backgroundimage.\n", " \n", " Example:\n", " >>> bgpic()\n", " 'nopic'\n", " >>> bgpic(\"landscape.gif\")\n", " >>> bgpic()\n", " 'landscape.gif'\n", " \n", " bk(distance)\n", " Move the turtle backward by distance.\n", " \n", " Aliases: back | backward | bk\n", " \n", " Argument:\n", " distance -- a number\n", " \n", " Move the turtle backward by distance ,opposite to the direction the\n", " turtle is headed. Do not change the turtle's heading.\n", " \n", " Example:\n", " >>> position()\n", " (0.00, 0.00)\n", " >>> backward(30)\n", " >>> position()\n", " (-30.00, 0.00)\n", " \n", " bye()\n", " Shut the turtlegraphics window.\n", " \n", " Example:\n", " >>> bye()\n", " \n", " circle(radius, extent=None, steps=None)\n", " Draw a circle with given radius.\n", " \n", " Arguments:\n", " radius -- a number\n", " extent (optional) -- a number\n", " steps (optional) -- an integer\n", " \n", " Draw a circle with given radius. The center is radius units left\n", " of the turtle; extent - an angle - determines which part of the\n", " circle is drawn. If extent is not given, draw the entire circle.\n", " If extent is not a full circle, one endpoint of the arc is the\n", " current pen position. Draw the arc in counterclockwise direction\n", " if radius is positive, otherwise in clockwise direction. Finally\n", " the direction of the turtle is changed by the amount of extent.\n", " \n", " As the circle is approximated by an inscribed regular polygon,\n", " steps determines the number of steps to use. If not given,\n", " it will be calculated automatically. Maybe used to draw regular\n", " polygons.\n", " \n", " call: circle(radius) # full circle\n", " --or: circle(radius, extent) # arc\n", " --or: circle(radius, extent, steps)\n", " --or: circle(radius, steps=6) # 6-sided polygon\n", " \n", " Example:\n", " >>> circle(50)\n", " >>> circle(120, 180) # semicircle\n", " \n", " clear()\n", " Delete the turtle's drawings from the screen. Do not move \n", " \n", " No arguments.\n", " \n", " Delete the turtle's drawings from the screen. Do not move \n", " State and position of the turtle as well as drawings of other\n", " turtles are not affected.\n", " \n", " Examples:\n", " >>> clear()\n", " \n", " clearscreen()\n", " Delete all drawings and all turtles from the TurtleScreen.\n", " \n", " No argument.\n", " \n", " Reset empty TurtleScreen to its initial state: white background,\n", " no backgroundimage, no eventbindings and tracing on.\n", " \n", " Example:\n", " >>> clear()\n", " \n", " Note: this method is not available as function.\n", " \n", " clearstamp(stampid)\n", " Delete stamp with given stampid\n", " \n", " Argument:\n", " stampid - an integer, must be return value of previous stamp() call.\n", " \n", " Example:\n", " >>> color(\"blue\")\n", " >>> astamp = stamp()\n", " >>> fd(50)\n", " >>> clearstamp(astamp)\n", " \n", " clearstamps(n=None)\n", " Delete all or first/last n of turtle's stamps.\n", " \n", " Optional argument:\n", " n -- an integer\n", " \n", " If n is None, delete all of pen's stamps,\n", " else if n > 0 delete first n stamps\n", " else if n < 0 delete last n stamps.\n", " \n", " Example:\n", " >>> for i in range(8):\n", " ... stamp(); fd(30)\n", " ...\n", " >>> clearstamps(2)\n", " >>> clearstamps(-2)\n", " >>> clearstamps()\n", " \n", " clone()\n", " Create and return a clone of the \n", " \n", " No argument.\n", " \n", " Create and return a clone of the turtle with same position, heading\n", " and turtle properties.\n", " \n", " Example (for a Turtle instance named mick):\n", " mick = Turtle()\n", " joe = mick.clone()\n", " \n", " color(*args)\n", " Return or set the pencolor and fillcolor.\n", " \n", " Arguments:\n", " Several input formats are allowed.\n", " They use 0, 1, 2, or 3 arguments as follows:\n", " \n", " color()\n", " Return the current pencolor and the current fillcolor\n", " as a pair of color specification strings as are returned\n", " by pencolor and fillcolor.\n", " color(colorstring), color((r,g,b)), color(r,g,b)\n", " inputs as in pencolor, set both, fillcolor and pencolor,\n", " to the given value.\n", " color(colorstring1, colorstring2),\n", " color((r1,g1,b1), (r2,g2,b2))\n", " equivalent to pencolor(colorstring1) and fillcolor(colorstring2)\n", " and analogously, if the other input format is used.\n", " \n", " If turtleshape is a polygon, outline and interior of that polygon\n", " is drawn with the newly set colors.\n", " For mor info see: pencolor, fillcolor\n", " \n", " Example:\n", " >>> color('red', 'green')\n", " >>> color()\n", " ('red', 'green')\n", " >>> colormode(255)\n", " >>> color((40, 80, 120), (160, 200, 240))\n", " >>> color()\n", " ('#285078', '#a0c8f0')\n", " \n", " colormode(cmode=None)\n", " Return the colormode or set it to 1.0 or 255.\n", " \n", " Optional argument:\n", " cmode -- one of the values 1.0 or 255\n", " \n", " r, g, b values of colortriples have to be in range 0..cmode.\n", " \n", " Example:\n", " >>> colormode()\n", " 1.0\n", " >>> colormode(255)\n", " >>> pencolor(240,160,80)\n", " \n", " degrees(fullcircle=360.0)\n", " Set angle measurement units to degrees.\n", " \n", " Optional argument:\n", " fullcircle - a number\n", " \n", " Set angle measurement units, i. e. set number\n", " of 'degrees' for a full circle. Dafault value is\n", " 360 degrees.\n", " \n", " Example:\n", " >>> left(90)\n", " >>> heading()\n", " 90\n", " \n", " Change angle measurement unit to grad (also known as gon,\n", " grade, or gradian and equals 1/100-th of the right angle.)\n", " >>> degrees(400.0)\n", " >>> heading()\n", " 100\n", " \n", " delay(delay=None)\n", " Return or set the drawing delay in milliseconds.\n", " \n", " Optional argument:\n", " delay -- positive integer\n", " \n", " Example:\n", " >>> delay(15)\n", " >>> delay()\n", " 15\n", " \n", " distance(x, y=None)\n", " Return the distance from the turtle to (x,y) in turtle step units.\n", " \n", " Arguments:\n", " x -- a number or a pair/vector of numbers or a turtle instance\n", " y -- a number None None\n", " \n", " call: distance(x, y) # two coordinates\n", " --or: distance((x, y)) # a pair (tuple) of coordinates\n", " --or: distance(vec) # e.g. as returned by pos()\n", " --or: distance(mypen) # where mypen is another turtle\n", " \n", " Example:\n", " >>> pos()\n", " (0.00, 0.00)\n", " >>> distance(30,40)\n", " 50.0\n", " >>> pen = Turtle()\n", " >>> pen.forward(77)\n", " >>> distance(pen)\n", " 77.0\n", " \n", " done = mainloop()\n", " Starts event loop - calling Tkinter's mainloop function.\n", " \n", " No argument.\n", " \n", " Must be last statement in a turtle graphics program.\n", " Must NOT be used if a script is run from within IDLE in -n mode\n", " (No subprocess) - for interactive use of turtle graphics.\n", " \n", " Example:\n", " >>> mainloop()\n", " \n", " dot(size=None, *color)\n", " Draw a dot with diameter size, using color.\n", " \n", " Optional arguments:\n", " size -- an integer >= 1 (if given)\n", " color -- a colorstring or a numeric color tuple\n", " \n", " Draw a circular dot with diameter size, using color.\n", " If size is not given, the maximum of pensize+4 and 2*pensize is used.\n", " \n", " Example:\n", " >>> dot()\n", " >>> fd(50); dot(20, \"blue\"); fd(50)\n", " \n", " down()\n", " Pull the pen down -- drawing when moving.\n", " \n", " Aliases: pendown | pd | down\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> pendown()\n", " \n", " end_fill()\n", " Fill the shape drawn after the call begin_fill().\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> color(\"black\", \"red\")\n", " >>> begin_fill()\n", " >>> circle(60)\n", " >>> end_fill()\n", " \n", " end_poly()\n", " Stop recording the vertices of a polygon.\n", " \n", " No argument.\n", " \n", " Stop recording the vertices of a polygon. Current turtle position is\n", " last point of polygon. This will be connected with the first point.\n", " \n", " Example:\n", " >>> end_poly()\n", " \n", " exitonclick()\n", " Go into mainloop until the mouse is clicked.\n", " \n", " No arguments.\n", " \n", " Bind bye() method to mouseclick on TurtleScreen.\n", " If \"using_IDLE\" - value in configuration dictionary is False\n", " (default value), enter mainloop.\n", " If IDLE with -n switch (no subprocess) is used, this value should be\n", " set to True in turtle.cfg. In this case IDLE's mainloop\n", " is active also for the client script.\n", " \n", " This is a method of the Screen-class and not available for\n", " TurtleScreen instances.\n", " \n", " Example:\n", " >>> exitonclick()\n", " \n", " fd(distance)\n", " Move the turtle forward by the specified distance.\n", " \n", " Aliases: forward | fd\n", " \n", " Argument:\n", " distance -- a number (integer or float)\n", " \n", " Move the turtle forward by the specified distance, in the direction\n", " the turtle is headed.\n", " \n", " Example:\n", " >>> position()\n", " (0.00, 0.00)\n", " >>> forward(25)\n", " >>> position()\n", " (25.00,0.00)\n", " >>> forward(-75)\n", " >>> position()\n", " (-50.00,0.00)\n", " \n", " fillcolor(*args)\n", " Return or set the fillcolor.\n", " \n", " Arguments:\n", " Four input formats are allowed:\n", " - fillcolor()\n", " Return the current fillcolor as color specification string,\n", " possibly in hex-number format (see example).\n", " May be used as input to another color/pencolor/fillcolor call.\n", " - fillcolor(colorstring)\n", " s is a Tk color specification string, such as \"red\" or \"yellow\"\n", " - fillcolor((r, g, b))\n", " *a tuple* of r, g, and b, which represent, an RGB color,\n", " and each of r, g, and b are in the range 0..colormode,\n", " where colormode is either 1.0 or 255\n", " - fillcolor(r, g, b)\n", " r, g, and b represent an RGB color, and each of r, g, and b\n", " are in the range 0..colormode\n", " \n", " If turtleshape is a polygon, the interior of that polygon is drawn\n", " with the newly set fillcolor.\n", " \n", " Example:\n", " >>> fillcolor('violet')\n", " >>> col = pencolor()\n", " >>> fillcolor(col)\n", " >>> fillcolor(0, .5, 0)\n", " \n", " filling()\n", " Return fillstate (True if filling, False else).\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> begin_fill()\n", " >>> if filling():\n", " ... pensize(5)\n", " ... else:\n", " ... pensize(3)\n", " \n", " forward(distance)\n", " Move the turtle forward by the specified distance.\n", " \n", " Aliases: forward | fd\n", " \n", " Argument:\n", " distance -- a number (integer or float)\n", " \n", " Move the turtle forward by the specified distance, in the direction\n", " the turtle is headed.\n", " \n", " Example:\n", " >>> position()\n", " (0.00, 0.00)\n", " >>> forward(25)\n", " >>> position()\n", " (25.00,0.00)\n", " >>> forward(-75)\n", " >>> position()\n", " (-50.00,0.00)\n", " \n", " get_poly()\n", " Return the lastly recorded polygon.\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> p = get_poly()\n", " >>> register_shape(\"myFavouriteShape\", p)\n", " \n", " get_shapepoly()\n", " Return the current shape polygon as tuple of coordinate pairs.\n", " \n", " No argument.\n", " \n", " Examples:\n", " >>> shape(\"square\")\n", " >>> shapetransform(4, -1, 0, 2)\n", " >>> get_shapepoly()\n", " ((50, -20), (30, 20), (-50, 20), (-30, -20))\n", " \n", " getcanvas()\n", " Return the Canvas of this TurtleScreen.\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> cv = getcanvas()\n", " >>> cv\n", " \n", " \n", " getpen()\n", " Return the Turtleobject itself.\n", " \n", " No argument.\n", " \n", " Only reasonable use: as a function to return the 'anonymous turtle':\n", " \n", " Example:\n", " >>> pet = getturtle()\n", " >>> pet.fd(50)\n", " >>> pet\n", " \n", " >>> turtles()\n", " []\n", " \n", " getscreen()\n", " Return the TurtleScreen object, the turtle is drawing on.\n", " \n", " No argument.\n", " \n", " Return the TurtleScreen object, the turtle is drawing on.\n", " So TurtleScreen-methods can be called for that object.\n", " \n", " Example:\n", " >>> ts = getscreen()\n", " >>> ts\n", " \n", " >>> ts.bgcolor(\"pink\")\n", " \n", " getshapes()\n", " Return a list of names of all currently available turtle shapes.\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> getshapes()\n", " ['arrow', 'blank', 'circle', ... , 'turtle']\n", " \n", " getturtle()\n", " Return the Turtleobject itself.\n", " \n", " No argument.\n", " \n", " Only reasonable use: as a function to return the 'anonymous turtle':\n", " \n", " Example:\n", " >>> pet = getturtle()\n", " >>> pet.fd(50)\n", " >>> pet\n", " \n", " >>> turtles()\n", " []\n", " \n", " goto(x, y=None)\n", " Move turtle to an absolute position.\n", " \n", " Aliases: setpos | setposition | goto:\n", " \n", " Arguments:\n", " x -- a number or a pair/vector of numbers\n", " y -- a number None\n", " \n", " call: goto(x, y) # two coordinates\n", " --or: goto((x, y)) # a pair (tuple) of coordinates\n", " --or: goto(vec) # e.g. as returned by pos()\n", " \n", " Move turtle to an absolute position. If the pen is down,\n", " a line will be drawn. The turtle's orientation does not change.\n", " \n", " Example:\n", " >>> tp = pos()\n", " >>> tp\n", " (0.00, 0.00)\n", " >>> setpos(60,30)\n", " >>> pos()\n", " (60.00,30.00)\n", " >>> setpos((20,80))\n", " >>> pos()\n", " (20.00,80.00)\n", " >>> setpos(tp)\n", " >>> pos()\n", " (0.00,0.00)\n", " \n", " heading()\n", " Return the turtle's current heading.\n", " \n", " No arguments.\n", " \n", " Example:\n", " >>> left(67)\n", " >>> heading()\n", " 67.0\n", " \n", " hideturtle()\n", " Makes the turtle invisible.\n", " \n", " Aliases: hideturtle | ht\n", " \n", " No argument.\n", " \n", " It's a good idea to do this while you're in the\n", " middle of a complicated drawing, because hiding\n", " the turtle speeds up the drawing observably.\n", " \n", " Example:\n", " >>> hideturtle()\n", " \n", " home()\n", " Move turtle to the origin - coordinates (0,0).\n", " \n", " No arguments.\n", " \n", " Move turtle to the origin - coordinates (0,0) and set its\n", " heading to its start-orientation (which depends on mode).\n", " \n", " Example:\n", " >>> home()\n", " \n", " ht()\n", " Makes the turtle invisible.\n", " \n", " Aliases: hideturtle | ht\n", " \n", " No argument.\n", " \n", " It's a good idea to do this while you're in the\n", " middle of a complicated drawing, because hiding\n", " the turtle speeds up the drawing observably.\n", " \n", " Example:\n", " >>> hideturtle()\n", " \n", " isdown()\n", " Return True if pen is down, False if it's up.\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> penup()\n", " >>> isdown()\n", " False\n", " >>> pendown()\n", " >>> isdown()\n", " True\n", " \n", " isvisible()\n", " Return True if the Turtle is shown, False if it's hidden.\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> hideturtle()\n", " >>> print isvisible():\n", " False\n", " \n", " left(angle)\n", " Turn turtle left by angle units.\n", " \n", " Aliases: left | lt\n", " \n", " Argument:\n", " angle -- a number (integer or float)\n", " \n", " Turn turtle left by angle units. (Units are by default degrees,\n", " but can be set via the degrees() and radians() functions.)\n", " Angle orientation depends on mode. (See this.)\n", " \n", " Example:\n", " >>> heading()\n", " 22.0\n", " >>> left(45)\n", " >>> heading()\n", " 67.0\n", " \n", " listen(xdummy=None, ydummy=None)\n", " Set focus on TurtleScreen (in order to collect key-events)\n", " \n", " No arguments.\n", " Dummy arguments are provided in order\n", " to be able to pass listen to the onclick method.\n", " \n", " Example:\n", " >>> listen()\n", " \n", " lt(angle)\n", " Turn turtle left by angle units.\n", " \n", " Aliases: left | lt\n", " \n", " Argument:\n", " angle -- a number (integer or float)\n", " \n", " Turn turtle left by angle units. (Units are by default degrees,\n", " but can be set via the degrees() and radians() functions.)\n", " Angle orientation depends on mode. (See this.)\n", " \n", " Example:\n", " >>> heading()\n", " 22.0\n", " >>> left(45)\n", " >>> heading()\n", " 67.0\n", " \n", " mainloop()\n", " Starts event loop - calling Tkinter's mainloop function.\n", " \n", " No argument.\n", " \n", " Must be last statement in a turtle graphics program.\n", " Must NOT be used if a script is run from within IDLE in -n mode\n", " (No subprocess) - for interactive use of turtle graphics.\n", " \n", " Example:\n", " >>> mainloop()\n", " \n", " mode(mode=None)\n", " Set turtle-mode ('standard', 'logo' or 'world') and perform reset.\n", " \n", " Optional argument:\n", " mode -- one of the strings 'standard', 'logo' or 'world'\n", " \n", " Mode 'standard' is compatible with turtle.py.\n", " Mode 'logo' is compatible with most Logo-Turtle-Graphics.\n", " Mode 'world' uses userdefined 'worldcoordinates'. *Attention*: in\n", " this mode angles appear distorted if x/y unit-ratio doesn't equal 1.\n", " If mode is not given, return the current mode.\n", " \n", " Mode Initial turtle heading positive angles\n", " ------------|-------------------------|-------------------\n", " 'standard' to the right (east) counterclockwise\n", " 'logo' upward (north) clockwise\n", " \n", " Examples:\n", " >>> mode('logo') # resets turtle heading to north\n", " >>> mode()\n", " 'logo'\n", " \n", " numinput(title, prompt, default=None, minval=None, maxval=None)\n", " Pop up a dialog window for input of a number.\n", " \n", " Arguments: title is the title of the dialog window,\n", " prompt is a text mostly describing what numerical information to input.\n", " default: default value\n", " minval: minimum value for imput\n", " maxval: maximum value for input\n", " \n", " The number input must be in the range minval .. maxval if these are\n", " given. If not, a hint is issued and the dialog remains open for\n", " correction. Return the number input.\n", " If the dialog is canceled, return None.\n", " \n", " Example:\n", " >>> numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, maxval=10000)\n", " \n", " onclick(fun, btn=1, add=None)\n", " Bind fun to mouse-click event on this turtle on canvas.\n", " \n", " Arguments:\n", " fun -- a function with two arguments, to which will be assigned\n", " the coordinates of the clicked point on the canvas.\n", " num -- number of the mouse-button defaults to 1 (left mouse button).\n", " add -- True or False. If True, new binding will be added, otherwise\n", " it will replace a former binding.\n", " \n", " Example for the anonymous turtle, i. e. the procedural way:\n", " \n", " >>> def turn(x, y):\n", " ... left(360)\n", " ...\n", " >>> onclick(turn) # Now clicking into the turtle will turn it.\n", " >>> onclick(None) # event-binding will be removed\n", " \n", " ondrag(fun, btn=1, add=None)\n", " Bind fun to mouse-move event on this turtle on canvas.\n", " \n", " Arguments:\n", " fun -- a function with two arguments, to which will be assigned\n", " the coordinates of the clicked point on the canvas.\n", " num -- number of the mouse-button defaults to 1 (left mouse button).\n", " \n", " Every sequence of mouse-move-events on a turtle is preceded by a\n", " mouse-click event on that \n", " \n", " Example:\n", " >>> ondrag(goto)\n", " \n", " Subsequently clicking and dragging a Turtle will move it\n", " across the screen thereby producing handdrawings (if pen is\n", " down).\n", " \n", " onkey(fun, key)\n", " Bind fun to key-release event of key.\n", " \n", " Arguments:\n", " fun -- a function with no arguments\n", " key -- a string: key (e.g. \"a\") or key-symbol (e.g. \"space\")\n", " \n", " In order to be able to register key-events, TurtleScreen\n", " must have focus. (See method listen.)\n", " \n", " Example:\n", " \n", " >>> def f():\n", " ... fd(50)\n", " ... lt(60)\n", " ...\n", " >>> onkey(f, \"Up\")\n", " >>> listen()\n", " \n", " Subsequently the turtle can be moved by repeatedly pressing\n", " the up-arrow key, consequently drawing a hexagon\n", " \n", " onkeypress(fun, key=None)\n", " Bind fun to key-press event of key if key is given,\n", " or to any key-press-event if no key is given.\n", " \n", " Arguments:\n", " fun -- a function with no arguments\n", " key -- a string: key (e.g. \"a\") or key-symbol (e.g. \"space\")\n", " \n", " In order to be able to register key-events, TurtleScreen\n", " must have focus. (See method listen.)\n", " \n", " Example (for a TurtleScreen instance named screen\n", " and a Turtle instance named turtle):\n", " \n", " >>> def f():\n", " ... fd(50)\n", " ... lt(60)\n", " ...\n", " >>> onkeypress(f, \"Up\")\n", " >>> listen()\n", " \n", " Subsequently the turtle can be moved by repeatedly pressing\n", " the up-arrow key, or by keeping pressed the up-arrow key.\n", " consequently drawing a hexagon.\n", " \n", " onkeyrelease(fun, key)\n", " Bind fun to key-release event of key.\n", " \n", " Arguments:\n", " fun -- a function with no arguments\n", " key -- a string: key (e.g. \"a\") or key-symbol (e.g. \"space\")\n", " \n", " In order to be able to register key-events, TurtleScreen\n", " must have focus. (See method listen.)\n", " \n", " Example:\n", " \n", " >>> def f():\n", " ... fd(50)\n", " ... lt(60)\n", " ...\n", " >>> onkey(f, \"Up\")\n", " >>> listen()\n", " \n", " Subsequently the turtle can be moved by repeatedly pressing\n", " the up-arrow key, consequently drawing a hexagon\n", " \n", " onrelease(fun, btn=1, add=None)\n", " Bind fun to mouse-button-release event on this turtle on canvas.\n", " \n", " Arguments:\n", " fun -- a function with two arguments, to which will be assigned\n", " the coordinates of the clicked point on the canvas.\n", " num -- number of the mouse-button defaults to 1 (left mouse button).\n", " \n", " Example (for a MyTurtle instance named joe):\n", " >>> class MyTurtle(Turtle):\n", " ... def glow(self,x,y):\n", " ... self.fillcolor(\"red\")\n", " ... def unglow(self,x,y):\n", " ... self.fillcolor(\"\")\n", " ...\n", " >>> joe = MyTurtle()\n", " >>> joe.onclick(joe.glow)\n", " >>> joe.onrelease(joe.unglow)\n", " \n", " Clicking on joe turns fillcolor red, unclicking turns it to\n", " transparent.\n", " \n", " onscreenclick(fun, btn=1, add=None)\n", " Bind fun to mouse-click event on canvas.\n", " \n", " Arguments:\n", " fun -- a function with two arguments, the coordinates of the\n", " clicked point on the canvas.\n", " num -- the number of the mouse-button, defaults to 1\n", " \n", " Example (for a TurtleScreen instance named screen)\n", " \n", " >>> onclick(goto)\n", " >>> # Subsequently clicking into the TurtleScreen will\n", " >>> # make the turtle move to the clicked point.\n", " >>> onclick(None)\n", " \n", " ontimer(fun, t=0)\n", " Install a timer, which calls fun after t milliseconds.\n", " \n", " Arguments:\n", " fun -- a function with no arguments.\n", " t -- a number >= 0\n", " \n", " Example:\n", " \n", " >>> running = True\n", " >>> def f():\n", " ... if running:\n", " ... fd(50)\n", " ... lt(60)\n", " ... ontimer(f, 250)\n", " ...\n", " >>> f() # makes the turtle marching around\n", " >>> running = False\n", " \n", " pd()\n", " Pull the pen down -- drawing when moving.\n", " \n", " Aliases: pendown | pd | down\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> pendown()\n", " \n", " pen(pen=None, **pendict)\n", " Return or set the pen's attributes.\n", " \n", " Arguments:\n", " pen -- a dictionary with some or all of the below listed keys.\n", " **pendict -- one or more keyword-arguments with the below\n", " listed keys as keywords.\n", " \n", " Return or set the pen's attributes in a 'pen-dictionary'\n", " with the following key/value pairs:\n", " \"shown\" : True/False\n", " \"pendown\" : True/False\n", " \"pencolor\" : color-string or color-tuple\n", " \"fillcolor\" : color-string or color-tuple\n", " \"pensize\" : positive number\n", " \"speed\" : number in range 0..10\n", " \"resizemode\" : \"auto\" or \"user\" or \"noresize\"\n", " \"stretchfactor\": (positive number, positive number)\n", " \"shearfactor\": number\n", " \"outline\" : positive number\n", " \"tilt\" : number\n", " \n", " This dictionary can be used as argument for a subsequent\n", " pen()-call to restore the former pen-state. Moreover one\n", " or more of these attributes can be provided as keyword-arguments.\n", " This can be used to set several pen attributes in one statement.\n", " \n", " \n", " Examples:\n", " >>> pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n", " >>> pen()\n", " {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " 'pencolor': 'red', 'pendown': True, 'fillcolor': 'black',\n", " 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " >>> penstate=pen()\n", " >>> color(\"yellow\",\"\")\n", " >>> penup()\n", " >>> pen()\n", " {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " 'pencolor': 'yellow', 'pendown': False, 'fillcolor': '',\n", " 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " >>> p.pen(penstate, fillcolor=\"green\")\n", " >>> p.pen()\n", " {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,\n", " 'pencolor': 'red', 'pendown': True, 'fillcolor': 'green',\n", " 'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}\n", " \n", " pencolor(*args)\n", " Return or set the pencolor.\n", " \n", " Arguments:\n", " Four input formats are allowed:\n", " - pencolor()\n", " Return the current pencolor as color specification string,\n", " possibly in hex-number format (see example).\n", " May be used as input to another color/pencolor/fillcolor call.\n", " - pencolor(colorstring)\n", " s is a Tk color specification string, such as \"red\" or \"yellow\"\n", " - pencolor((r, g, b))\n", " *a tuple* of r, g, and b, which represent, an RGB color,\n", " and each of r, g, and b are in the range 0..colormode,\n", " where colormode is either 1.0 or 255\n", " - pencolor(r, g, b)\n", " r, g, and b represent an RGB color, and each of r, g, and b\n", " are in the range 0..colormode\n", " \n", " If turtleshape is a polygon, the outline of that polygon is drawn\n", " with the newly set pencolor.\n", " \n", " Example:\n", " >>> pencolor('brown')\n", " >>> tup = (0.2, 0.8, 0.55)\n", " >>> pencolor(tup)\n", " >>> pencolor()\n", " '#33cc8c'\n", " \n", " pendown()\n", " Pull the pen down -- drawing when moving.\n", " \n", " Aliases: pendown | pd | down\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> pendown()\n", " \n", " pensize(width=None)\n", " Set or return the line thickness.\n", " \n", " Aliases: pensize | width\n", " \n", " Argument:\n", " width -- positive number\n", " \n", " Set the line thickness to width or return it. If resizemode is set\n", " to \"auto\" and turtleshape is a polygon, that polygon is drawn with\n", " the same line thickness. If no argument is given, current pensize\n", " is returned.\n", " \n", " Example:\n", " >>> pensize()\n", " 1\n", " >>> pensize(10) # from here on lines of width 10 are drawn\n", " \n", " penup()\n", " Pull the pen up -- no drawing when moving.\n", " \n", " Aliases: penup | pu | up\n", " \n", " No argument\n", " \n", " Example:\n", " >>> penup()\n", " \n", " pos()\n", " Return the turtle's current location (x,y), as a Vec2D-vector.\n", " \n", " Aliases: pos | position\n", " \n", " No arguments.\n", " \n", " Example:\n", " >>> pos()\n", " (0.00, 240.00)\n", " \n", " position()\n", " Return the turtle's current location (x,y), as a Vec2D-vector.\n", " \n", " Aliases: pos | position\n", " \n", " No arguments.\n", " \n", " Example:\n", " >>> pos()\n", " (0.00, 240.00)\n", " \n", " pu()\n", " Pull the pen up -- no drawing when moving.\n", " \n", " Aliases: penup | pu | up\n", " \n", " No argument\n", " \n", " Example:\n", " >>> penup()\n", " \n", " radians()\n", " Set the angle measurement units to radians.\n", " \n", " No arguments.\n", " \n", " Example:\n", " >>> heading()\n", " 90\n", " >>> radians()\n", " >>> heading()\n", " 1.5707963267948966\n", " \n", " register_shape(name, shape=None)\n", " Adds a turtle shape to TurtleScreen's shapelist.\n", " \n", " Arguments:\n", " (1) name is the name of a gif-file and shape is None.\n", " Installs the corresponding image shape.\n", " !! Image-shapes DO NOT rotate when turning the turtle,\n", " !! so they do not display the heading of the turtle!\n", " (2) name is an arbitrary string and shape is a tuple\n", " of pairs of coordinates. Installs the corresponding\n", " polygon shape\n", " (3) name is an arbitrary string and shape is a\n", " (compound) Shape object. Installs the corresponding\n", " compound shape.\n", " To use a shape, you have to issue the command shape(shapename).\n", " \n", " call: register_shape(\"turtle.gif\")\n", " --or: register_shape(\"tri\", ((0,0), (10,10), (-10,10)))\n", " \n", " Example:\n", " >>> register_shape(\"triangle\", ((5,-3),(0,5),(-5,-3)))\n", " \n", " reset()\n", " Delete the turtle's drawings and restore its default values.\n", " \n", " No argument.\n", " \n", " Delete the turtle's drawings from the screen, re-center the turtle\n", " and set variables to the default values.\n", " \n", " Example:\n", " >>> position()\n", " (0.00,-22.00)\n", " >>> heading()\n", " 100.0\n", " >>> reset()\n", " >>> position()\n", " (0.00,0.00)\n", " >>> heading()\n", " 0.0\n", " \n", " resetscreen()\n", " Reset all Turtles on the Screen to their initial state.\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> reset()\n", " \n", " resizemode(rmode=None)\n", " Set resizemode to one of the values: \"auto\", \"user\", \"noresize\".\n", " \n", " (Optional) Argument:\n", " rmode -- one of the strings \"auto\", \"user\", \"noresize\"\n", " \n", " Different resizemodes have the following effects:\n", " - \"auto\" adapts the appearance of the turtle\n", " corresponding to the value of pensize.\n", " - \"user\" adapts the appearance of the turtle according to the\n", " values of stretchfactor and outlinewidth (outline),\n", " which are set by shapesize()\n", " - \"noresize\" no adaption of the turtle's appearance takes place.\n", " If no argument is given, return current resizemode.\n", " resizemode(\"user\") is called by a call of shapesize with arguments.\n", " \n", " \n", " Examples:\n", " >>> resizemode(\"noresize\")\n", " >>> resizemode()\n", " 'noresize'\n", " \n", " right(angle)\n", " Turn turtle right by angle units.\n", " \n", " Aliases: right | rt\n", " \n", " Argument:\n", " angle -- a number (integer or float)\n", " \n", " Turn turtle right by angle units. (Units are by default degrees,\n", " but can be set via the degrees() and radians() functions.)\n", " Angle orientation depends on mode. (See this.)\n", " \n", " Example:\n", " >>> heading()\n", " 22.0\n", " >>> right(45)\n", " >>> heading()\n", " 337.0\n", " \n", " rt(angle)\n", " Turn turtle right by angle units.\n", " \n", " Aliases: right | rt\n", " \n", " Argument:\n", " angle -- a number (integer or float)\n", " \n", " Turn turtle right by angle units. (Units are by default degrees,\n", " but can be set via the degrees() and radians() functions.)\n", " Angle orientation depends on mode. (See this.)\n", " \n", " Example:\n", " >>> heading()\n", " 22.0\n", " >>> right(45)\n", " >>> heading()\n", " 337.0\n", " \n", " screensize(canvwidth=None, canvheight=None, bg=None)\n", " Resize the canvas the turtles are drawing on.\n", " \n", " Optional arguments:\n", " canvwidth -- positive integer, new width of canvas in pixels\n", " canvheight -- positive integer, new height of canvas in pixels\n", " bg -- colorstring or color-tuple, new backgroundcolor\n", " If no arguments are given, return current (canvaswidth, canvasheight)\n", " \n", " Do not alter the drawing window. To observe hidden parts of\n", " the canvas use the scrollbars. (Can make visible those parts\n", " of a drawing, which were outside the canvas before!)\n", " \n", " Example (for a Turtle instance named turtle):\n", " >>> turtle.screensize(2000,1500)\n", " >>> # e.g. to search for an erroneously escaped turtle ;-)\n", " \n", " seth(to_angle)\n", " Set the orientation of the turtle to to_angle.\n", " \n", " Aliases: setheading | seth\n", " \n", " Argument:\n", " to_angle -- a number (integer or float)\n", " \n", " Set the orientation of the turtle to to_angle.\n", " Here are some common directions in degrees:\n", " \n", " standard - mode: logo-mode:\n", " -------------------|--------------------\n", " 0 - east 0 - north\n", " 90 - north 90 - east\n", " 180 - west 180 - south\n", " 270 - south 270 - west\n", " \n", " Example:\n", " >>> setheading(90)\n", " >>> heading()\n", " 90\n", " \n", " setheading(to_angle)\n", " Set the orientation of the turtle to to_angle.\n", " \n", " Aliases: setheading | seth\n", " \n", " Argument:\n", " to_angle -- a number (integer or float)\n", " \n", " Set the orientation of the turtle to to_angle.\n", " Here are some common directions in degrees:\n", " \n", " standard - mode: logo-mode:\n", " -------------------|--------------------\n", " 0 - east 0 - north\n", " 90 - north 90 - east\n", " 180 - west 180 - south\n", " 270 - south 270 - west\n", " \n", " Example:\n", " >>> setheading(90)\n", " >>> heading()\n", " 90\n", " \n", " setpos(x, y=None)\n", " Move turtle to an absolute position.\n", " \n", " Aliases: setpos | setposition | goto:\n", " \n", " Arguments:\n", " x -- a number or a pair/vector of numbers\n", " y -- a number None\n", " \n", " call: goto(x, y) # two coordinates\n", " --or: goto((x, y)) # a pair (tuple) of coordinates\n", " --or: goto(vec) # e.g. as returned by pos()\n", " \n", " Move turtle to an absolute position. If the pen is down,\n", " a line will be drawn. The turtle's orientation does not change.\n", " \n", " Example:\n", " >>> tp = pos()\n", " >>> tp\n", " (0.00, 0.00)\n", " >>> setpos(60,30)\n", " >>> pos()\n", " (60.00,30.00)\n", " >>> setpos((20,80))\n", " >>> pos()\n", " (20.00,80.00)\n", " >>> setpos(tp)\n", " >>> pos()\n", " (0.00,0.00)\n", " \n", " setposition(x, y=None)\n", " Move turtle to an absolute position.\n", " \n", " Aliases: setpos | setposition | goto:\n", " \n", " Arguments:\n", " x -- a number or a pair/vector of numbers\n", " y -- a number None\n", " \n", " call: goto(x, y) # two coordinates\n", " --or: goto((x, y)) # a pair (tuple) of coordinates\n", " --or: goto(vec) # e.g. as returned by pos()\n", " \n", " Move turtle to an absolute position. If the pen is down,\n", " a line will be drawn. The turtle's orientation does not change.\n", " \n", " Example:\n", " >>> tp = pos()\n", " >>> tp\n", " (0.00, 0.00)\n", " >>> setpos(60,30)\n", " >>> pos()\n", " (60.00,30.00)\n", " >>> setpos((20,80))\n", " >>> pos()\n", " (20.00,80.00)\n", " >>> setpos(tp)\n", " >>> pos()\n", " (0.00,0.00)\n", " \n", " settiltangle(angle)\n", " Rotate the turtleshape to point in the specified direction\n", " \n", " Argument: angle -- number\n", " \n", " Rotate the turtleshape to point in the direction specified by angle,\n", " regardless of its current tilt-angle. DO NOT change the turtle's\n", " heading (direction of movement).\n", " \n", " \n", " Examples:\n", " >>> shape(\"circle\")\n", " >>> shapesize(5,2)\n", " >>> settiltangle(45)\n", " >>> stamp()\n", " >>> fd(50)\n", " >>> settiltangle(-45)\n", " >>> stamp()\n", " >>> fd(50)\n", " \n", " setundobuffer(size)\n", " Set or disable undobuffer.\n", " \n", " Argument:\n", " size -- an integer or None\n", " \n", " If size is an integer an empty undobuffer of given size is installed.\n", " Size gives the maximum number of turtle-actions that can be undone\n", " by the undo() function.\n", " If size is None, no undobuffer is present.\n", " \n", " Example:\n", " >>> setundobuffer(42)\n", " \n", " setup(width=0.5, height=0.75, startx=None, starty=None)\n", " Set the size and position of the main window.\n", " \n", " Arguments:\n", " width: as integer a size in pixels, as float a fraction of the \n", " Default is 50% of \n", " height: as integer the height in pixels, as float a fraction of the\n", " Default is 75% of \n", " startx: if positive, starting position in pixels from the left\n", " edge of the screen, if negative from the right edge\n", " Default, startx=None is to center window horizontally.\n", " starty: if positive, starting position in pixels from the top\n", " edge of the screen, if negative from the bottom edge\n", " Default, starty=None is to center window vertically.\n", " \n", " Examples:\n", " >>> setup (width=200, height=200, startx=0, starty=0)\n", " \n", " sets window to 200x200 pixels, in upper left of screen\n", " \n", " >>> setup(width=.75, height=0.5, startx=None, starty=None)\n", " \n", " sets window to 75% of screen by 50% of screen and centers\n", " \n", " setworldcoordinates(llx, lly, urx, ury)\n", " Set up a user defined coordinate-system.\n", " \n", " Arguments:\n", " llx -- a number, x-coordinate of lower left corner of canvas\n", " lly -- a number, y-coordinate of lower left corner of canvas\n", " urx -- a number, x-coordinate of upper right corner of canvas\n", " ury -- a number, y-coordinate of upper right corner of canvas\n", " \n", " Set up user coodinat-system and switch to mode 'world' if necessary.\n", " This performs a reset. If mode 'world' is already active,\n", " all drawings are redrawn according to the new coordinates.\n", " \n", " But ATTENTION: in user-defined coordinatesystems angles may appear\n", " distorted. (see Screen.mode())\n", " \n", " Example:\n", " >>> setworldcoordinates(-10,-0.5,50,1.5)\n", " >>> for _ in range(36):\n", " ... left(10)\n", " ... forward(0.5)\n", " \n", " setx(x)\n", " Set the turtle's first coordinate to x\n", " \n", " Argument:\n", " x -- a number (integer or float)\n", " \n", " Set the turtle's first coordinate to x, leave second coordinate\n", " unchanged.\n", " \n", " Example:\n", " >>> position()\n", " (0.00, 240.00)\n", " >>> setx(10)\n", " >>> position()\n", " (10.00, 240.00)\n", " \n", " sety(y)\n", " Set the turtle's second coordinate to y\n", " \n", " Argument:\n", " y -- a number (integer or float)\n", " \n", " Set the turtle's first coordinate to x, second coordinate remains\n", " unchanged.\n", " \n", " Example:\n", " >>> position()\n", " (0.00, 40.00)\n", " >>> sety(-10)\n", " >>> position()\n", " (0.00, -10.00)\n", " \n", " shape(name=None)\n", " Set turtle shape to shape with given name / return current shapename.\n", " \n", " Optional argument:\n", " name -- a string, which is a valid shapename\n", " \n", " Set turtle shape to shape with given name or, if name is not given,\n", " return name of current shape.\n", " Shape with name must exist in the TurtleScreen's shape dictionary.\n", " Initially there are the following polygon shapes:\n", " 'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'.\n", " To learn about how to deal with shapes see Screen-method register_shape.\n", " \n", " Example:\n", " >>> shape()\n", " 'arrow'\n", " >>> shape(\"turtle\")\n", " >>> shape()\n", " 'turtle'\n", " \n", " shapesize(stretch_wid=None, stretch_len=None, outline=None)\n", " Set/return turtle's stretchfactors/outline. Set resizemode to \"user\".\n", " \n", " Optional arguments:\n", " stretch_wid : positive number\n", " stretch_len : positive number\n", " outline : positive number\n", " \n", " Return or set the pen's attributes x/y-stretchfactors and/or outline.\n", " Set resizemode to \"user\".\n", " If and only if resizemode is set to \"user\", the turtle will be displayed\n", " stretched according to its stretchfactors:\n", " stretch_wid is stretchfactor perpendicular to orientation\n", " stretch_len is stretchfactor in direction of turtles orientation.\n", " outline determines the width of the shapes's outline.\n", " \n", " Examples:\n", " >>> resizemode(\"user\")\n", " >>> shapesize(5, 5, 12)\n", " >>> shapesize(outline=8)\n", " \n", " shapetransform(t11=None, t12=None, t21=None, t22=None)\n", " Set or return the current transformation matrix of the turtle shape.\n", " \n", " Optional arguments: t11, t12, t21, t22 -- numbers.\n", " \n", " If none of the matrix elements are given, return the transformation\n", " matrix.\n", " Otherwise set the given elements and transform the turtleshape\n", " according to the matrix consisting of first row t11, t12 and\n", " second row t21, 22.\n", " Modify stretchfactor, shearfactor and tiltangle according to the\n", " given matrix.\n", " \n", " Examples:\n", " >>> shape(\"square\")\n", " >>> shapesize(4,2)\n", " >>> shearfactor(-0.5)\n", " >>> shapetransform()\n", " (4.0, -1.0, -0.0, 2.0)\n", " \n", " shearfactor(shear=None)\n", " Set or return the current shearfactor.\n", " \n", " Optional argument: shear -- number, tangent of the shear angle\n", " \n", " Shear the turtleshape according to the given shearfactor shear,\n", " which is the tangent of the shear angle. DO NOT change the\n", " turtle's heading (direction of movement).\n", " If shear is not given: return the current shearfactor, i. e. the\n", " tangent of the shear angle, by which lines parallel to the\n", " heading of the turtle are sheared.\n", " \n", " Examples:\n", " >>> shape(\"circle\")\n", " >>> shapesize(5,2)\n", " >>> shearfactor(0.5)\n", " >>> shearfactor()\n", " >>> 0.5\n", " \n", " showturtle()\n", " Makes the turtle visible.\n", " \n", " Aliases: showturtle | st\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> hideturtle()\n", " >>> showturtle()\n", " \n", " speed(speed=None)\n", " Return or set the turtle's speed.\n", " \n", " Optional argument:\n", " speed -- an integer in the range 0..10 or a speedstring (see below)\n", " \n", " Set the turtle's speed to an integer value in the range 0 .. 10.\n", " If no argument is given: return current speed.\n", " \n", " If input is a number greater than 10 or smaller than 0.5,\n", " speed is set to 0.\n", " Speedstrings are mapped to speedvalues in the following way:\n", " 'fastest' : 0\n", " 'fast' : 10\n", " 'normal' : 6\n", " 'slow' : 3\n", " 'slowest' : 1\n", " speeds from 1 to 10 enforce increasingly faster animation of\n", " line drawing and turtle turning.\n", " \n", " Attention:\n", " speed = 0 : *no* animation takes place. forward/back makes turtle jump\n", " and likewise left/right make the turtle turn instantly.\n", " \n", " Example:\n", " >>> speed(3)\n", " \n", " st()\n", " Makes the turtle visible.\n", " \n", " Aliases: showturtle | st\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> hideturtle()\n", " >>> showturtle()\n", " \n", " stamp()\n", " Stamp a copy of the turtleshape onto the canvas and return its id.\n", " \n", " No argument.\n", " \n", " Stamp a copy of the turtle shape onto the canvas at the current\n", " turtle position. Return a stamp_id for that stamp, which can be\n", " used to delete it by calling clearstamp(stamp_id).\n", " \n", " Example:\n", " >>> color(\"blue\")\n", " >>> stamp()\n", " 13\n", " >>> fd(50)\n", " \n", " textinput(title, prompt)\n", " Pop up a dialog window for input of a string.\n", " \n", " Arguments: title is the title of the dialog window,\n", " prompt is a text mostly describing what information to input.\n", " \n", " Return the string input\n", " If the dialog is canceled, return None.\n", " \n", " Example:\n", " >>> textinput(\"NIM\", \"Name of first player:\")\n", " \n", " tilt(angle)\n", " Rotate the turtleshape by angle.\n", " \n", " Argument:\n", " angle - a number\n", " \n", " Rotate the turtleshape by angle from its current tilt-angle,\n", " but do NOT change the turtle's heading (direction of movement).\n", " \n", " Examples:\n", " >>> shape(\"circle\")\n", " >>> shapesize(5,2)\n", " >>> tilt(30)\n", " >>> fd(50)\n", " >>> tilt(30)\n", " >>> fd(50)\n", " \n", " tiltangle(angle=None)\n", " Set or return the current tilt-angle.\n", " \n", " Optional argument: angle -- number\n", " \n", " Rotate the turtleshape to point in the direction specified by angle,\n", " regardless of its current tilt-angle. DO NOT change the turtle's\n", " heading (direction of movement).\n", " If angle is not given: return the current tilt-angle, i. e. the angle\n", " between the orientation of the turtleshape and the heading of the\n", " turtle (its direction of movement).\n", " \n", " Deprecated since Python 3.1\n", " \n", " Examples:\n", " >>> shape(\"circle\")\n", " >>> shapesize(5,2)\n", " >>> tilt(45)\n", " >>> tiltangle()\n", " \n", " title(titlestring)\n", " Set title of turtle-window\n", " \n", " Argument:\n", " titlestring -- a string, to appear in the titlebar of the\n", " turtle graphics window.\n", " \n", " This is a method of Screen-class. Not available for TurtleScreen-\n", " objects.\n", " \n", " Example:\n", " >>> title(\"Welcome to the turtle-zoo!\")\n", " \n", " towards(x, y=None)\n", " Return the angle of the line from the turtle's position to (x, y).\n", " \n", " Arguments:\n", " x -- a number or a pair/vector of numbers or a turtle instance\n", " y -- a number None None\n", " \n", " call: distance(x, y) # two coordinates\n", " --or: distance((x, y)) # a pair (tuple) of coordinates\n", " --or: distance(vec) # e.g. as returned by pos()\n", " --or: distance(mypen) # where mypen is another turtle\n", " \n", " Return the angle, between the line from turtle-position to position\n", " specified by x, y and the turtle's start orientation. (Depends on\n", " modes - \"standard\" or \"logo\")\n", " \n", " Example:\n", " >>> pos()\n", " (10.00, 10.00)\n", " >>> towards(0,0)\n", " 225.0\n", " \n", " tracer(n=None, delay=None)\n", " Turns turtle animation on/off and set delay for update drawings.\n", " \n", " Optional arguments:\n", " n -- nonnegative integer\n", " delay -- nonnegative integer\n", " \n", " If n is given, only each n-th regular screen update is really performed.\n", " (Can be used to accelerate the drawing of complex graphics.)\n", " Second arguments sets delay value (see RawTurtle.delay())\n", " \n", " Example:\n", " >>> tracer(8, 25)\n", " >>> dist = 2\n", " >>> for i in range(200):\n", " ... fd(dist)\n", " ... rt(90)\n", " ... dist += 2\n", " \n", " turtles()\n", " Return the list of turtles on the \n", " \n", " Example:\n", " >>> turtles()\n", " []\n", " \n", " turtlesize(stretch_wid=None, stretch_len=None, outline=None)\n", " Set/return turtle's stretchfactors/outline. Set resizemode to \"user\".\n", " \n", " Optional arguments:\n", " stretch_wid : positive number\n", " stretch_len : positive number\n", " outline : positive number\n", " \n", " Return or set the pen's attributes x/y-stretchfactors and/or outline.\n", " Set resizemode to \"user\".\n", " If and only if resizemode is set to \"user\", the turtle will be displayed\n", " stretched according to its stretchfactors:\n", " stretch_wid is stretchfactor perpendicular to orientation\n", " stretch_len is stretchfactor in direction of turtles orientation.\n", " outline determines the width of the shapes's outline.\n", " \n", " Examples:\n", " >>> resizemode(\"user\")\n", " >>> shapesize(5, 5, 12)\n", " >>> shapesize(outline=8)\n", " \n", " undo()\n", " undo (repeatedly) the last turtle action.\n", " \n", " No argument.\n", " \n", " undo (repeatedly) the last turtle action.\n", " Number of available undo actions is determined by the size of\n", " the undobuffer.\n", " \n", " Example:\n", " >>> for i in range(4):\n", " ... fd(50); lt(80)\n", " ...\n", " >>> for i in range(8):\n", " ... undo()\n", " ...\n", " \n", " undobufferentries()\n", " Return count of entries in the undobuffer.\n", " \n", " No argument.\n", " \n", " Example:\n", " >>> while undobufferentries():\n", " ... undo()\n", " \n", " up()\n", " Pull the pen up -- no drawing when moving.\n", " \n", " Aliases: penup | pu | up\n", " \n", " No argument\n", " \n", " Example:\n", " >>> penup()\n", " \n", " update()\n", " Perform a TurtleScreen update.\n", " \n", " width(width=None)\n", " Set or return the line thickness.\n", " \n", " Aliases: pensize | width\n", " \n", " Argument:\n", " width -- positive number\n", " \n", " Set the line thickness to width or return it. If resizemode is set\n", " to \"auto\" and turtleshape is a polygon, that polygon is drawn with\n", " the same line thickness. If no argument is given, current pensize\n", " is returned.\n", " \n", " Example:\n", " >>> pensize()\n", " 1\n", " >>> pensize(10) # from here on lines of width 10 are drawn\n", " \n", " window_height()\n", " Return the height of the turtle window.\n", " \n", " Example:\n", " >>> window_height()\n", " 480\n", " \n", " window_width()\n", " Return the width of the turtle window.\n", " \n", " Example:\n", " >>> window_width()\n", " 640\n", " \n", " write(arg, move=False, align='left', font=('Arial', 8, 'normal'))\n", " Write text at the current turtle position.\n", " \n", " Arguments:\n", " arg -- info, which is to be written to the TurtleScreen\n", " move (optional) -- True/False\n", " align (optional) -- one of the strings \"left\", \"center\" or right\"\n", " font (optional) -- a triple (fontname, fontsize, fonttype)\n", " \n", " Write text - the string representation of arg - at the current\n", " turtle position according to align (\"left\", \"center\" or right\")\n", " and with the given font.\n", " If move is True, the pen is moved to the bottom-right corner\n", " of the text. By default, move is False.\n", " \n", " Example:\n", " >>> write('Home = ', True, align=\"center\")\n", " >>> write((0,0), True)\n", " \n", " write_docstringdict(filename='turtle_docstringdict')\n", " Create and write docstring-dictionary to file.\n", " \n", " Optional argument:\n", " filename -- a string, used as filename\n", " default value is turtle_docstringdict\n", " \n", " Has to be called explicitly, (not used by the turtle-graphics classes)\n", " The docstring dictionary will be written to the Python script .py\n", " It is intended to serve as a template for translation of the docstrings\n", " into different languages.\n", " \n", " xcor()\n", " Return the turtle's x coordinate.\n", " \n", " No arguments.\n", " \n", " Example:\n", " >>> reset()\n", " >>> left(60)\n", " >>> forward(100)\n", " >>> print xcor()\n", " 50.0\n", " \n", " ycor()\n", " Return the turtle's y coordinate\n", " ---\n", " No arguments.\n", " \n", " Example:\n", " >>> reset()\n", " >>> left(60)\n", " >>> forward(100)\n", " >>> print ycor()\n", " 86.6025403784\n", "\n", "DATA\n", " __all__ = ['ScrolledCanvas', 'TurtleScreen', 'Screen', 'RawTurtle', 'T...\n", "\n", "FILE\n", " /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/turtle.py\n", "\n", "\n" ] } ], "source": [ "help(turtle)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import turtle # Allows us to use turtles\n", "wn = turtle.Screen() # Creates a playground for turtles\n", "alex = turtle.Turtle() # Create a turtle, assign to alex\n", "\n", "alex.forward(50) # Tell alex to move forward by 50 units\n", "alex.left(90) # Tell alex to turn by 90 degrees\n", "alex.forward(30) # Complete the second side of a rectangle\n", "\n", "wn.mainloop() # Wait for user to close window" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### add some colors" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import turtle\n", "wn = turtle.Screen()\n", "wn.bgcolor(\"lightgreen\") # Set the window background color\n", "wn.title(\"Hello, Tess!\") # Set the window title\n", "\n", "tess = turtle.Turtle()\n", "tess.color(\"blue\") # Tell tess to change her color\n", "tess.pensize(3) # Tell tess to set her pen width\n", "\n", "tess.forward(50)\n", "tess.left(120)\n", "tess.forward(50)\n", "\n", "wn.mainloop()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.2" } }, "nbformat": 4, "nbformat_minor": 2 }