turtle graphics

4
TURTLE GRAPHICS WITH PYTHON

Upload: grahamwell

Post on 22-Nov-2014

654 views

Category:

Documents


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Turtle graphics

TURTLE GRAPHICSWITH PYTHON

Page 2: Turtle graphics

Using a Turtle

Imagine a Turtle … Crawling over a huge

sheet of paper With a pen tied to its

tail.

You can command it.

Page 3: Turtle graphics

The basicsTells Python to use the

Turtle module

Sets up a Turtle and makes it a Turtle Shape

Moves forward 100 pixels

Turns right by 90 degrees

Closes the graphic window when you quit

Page 4: Turtle graphics

Challenges

Draw a square:By repeating the same commands four

times Using ‘For I in range(4):’

Draw a hexagon Allow the user to say how many sides

the polygon should haveRemember, use ‘myVariable = int(raw_input)’ to get a number from the user

Get the turtle to draw your initials