{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

turtlegraph - Turtle Graphics Turtle graphics was rst...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Turtle Graphics Turtle graphics was first developed as part of the children’s programming language Logo in the late 1960’s. It exemplifies OOP extremely well. There are various versions of Turtle Graphics defined for Python. The version we’re going to use is defined in Chapter 7 of your textbook. It is not the version from Lambert’s earlier book. Objects are turtles that move about on a screen (window). The turtle’s tail can be up or down. When it is down, the turtle draws on the screen as it moves. CS313E Slideset 3: 4 Turtle Graphics
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The Turtle’s State A turtle has a given position designated by it’s ( x , y ) coordinates, with (0 , 0) being in the middle of the window. The state of the turtle consists of: Position: denoted by its current x and y coordinates Heading: denoted by an angle in degrees. East is 0 degrees; north is 90 degrees; west is 180 degrees; south is 270 degrees. Color: initially blue, the color can be set to 16 million colors Width: the width of the line drawn as the turtle moves (initially 2 pixels) Down: an attribute indicating that the turtle’s tail is down. CS313E Slideset 3: 5 Turtle Graphics
Background image of page 2
Turtle Methods Some of the methods are listing on p. 250 of your textbook.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}