.. CS116 documentation master file, created by
   sphinx-quickstart on Mon Mar  4 10:37:08 2019.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Turtle
======

The Turtle module allows you to interactively move animated turtles around.

By default, they draw their path as they move, so you can use them to draw shapes.

Example Usage
-------------

.. code:: python
   
   # Create a new turtle.
   turtle = Turtle()
   
   # Move the turtle forward 30 pixels.
   turtle.forward(30)
   
   # Turn the turtle right 45 degrees.
   turtle.right(45)
   
   # Move the turtle forward 100 pixels.
   turtle.forward(100)

Initialization
--------------

.. py:function:: Turtle.Turtle(self, x, y)
   
   :param float x: horizontal location of the turtle. Defaults to 0.
   :param float y: vertical location of the turtle. Defaults to 0.

.. code:: python
   
   turtle = Turtle()

Methods
-------

Move the turtle forward.

.. py:function:: Turtle.forward(self, distance)

   :param float distance: the number of pixels you want the turtle moved forward.
   
.. code:: python
   
   turtle.forward(100)
   
Turn the turtle right.

.. py:function:: Turtle.right(self, degrees)

   :param float degrees: the degrees you want the turtle turned right.
   
.. code:: python
   
   turtle.right(45)

Turn the turtle left.

.. py:function:: Turtle.left(self, degrees)

   :param float degrees: the degrees you want the turtle turned left.
   
.. code:: python
   
   turtle.left(90)

Set the position of the turtle to (x, y).

.. py:function:: Turtle.setpos(self, x, y)

   :param float x: desired horizontal position of turtle.
   :param float y: desired vertical position of turtle.
   
Stop the turtle from drawing its movement path.

.. py:function:: Turtle.penup(self)

.. code:: python
   
   turtle.penup()
   
Let the turtle draw its path again.

.. py:function:: Turtle.penup(self)

.. code:: python
   
   turtle.pendown()

Fill in a shape as the turtle draws it.

.. py:function:: Turtle.begin_fill(self)

.. code:: python
   
   turtle.begin_fill()

Stop filling in a shape as the turtle draws it.

.. py:function:: Turtle.end_fill(self)

.. code:: python
   
   turtle.end_fill()
   

