Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Common Turtle Methods

MOVEMENT:
myTurtle.forward() # by 100 pixels is the default
myTurtle.forward(pixels)  # pixels must be an integer

myTurtle.backward() # by 100 100 pixels is the default
myTurtle.backward(pixels)  # pixels must be an integer

myTurtle.moveTo(x, y)  # x and y are integers

myTurtle.turnLeft() # perfect 90 degree left turn
myTurtle.turnRight() # perfect 90 degree right turn
myTurtle.turn(degrees)  # degrees is an integer

myTurtle.turnToFace(turtle)  # turtle must be another turtle
myTurtle.turnToFace(x, y)  # x and y are integers

DROPPING A PICTURE:
# note that if you are trying to set a background
# you should move the turtle to 0, 0 first and
# be sure it is facing up before doing the drop
myTurtle.drop(picture)  # picture must be exactly that - a picture

APPEARANCE OF TURTLE:
myTurtle.hide()
myTurtle.show()

# color must be a color
myTurtle.setColor(color)
myTurtle.setShellColor(color) 
myTurtle.setBodyColor(color)

myTurtle.setWidth(width)    # width in pixels is an integer
myTurtle.setHeight(height)  # height in pixels is an integer

myTurtle.isVisible()
myTurtle.getShellColor()
myTurtle.getBodyColor()
myTurtle.getWidth()
myTurtle.getHeight()


WHERE IS THE TURTLE?
myTurtle.getXPos()
myTurtle.getYPos()
myTurtle.getDistance(x, y)  # x and y are integers

PEN CONFIGURATION:
myTurtle.penUp()
myTurtle.penDown()

myTurtle.setPenColor(color)  # color is a color
myTurtle.setPenWidth(width)  # width in pixels is an integer

myTurtle.getPenWidth()
myTurtle.getPenColor()
myTurtle.getPen()
myTurtle.setPen(pen)  # pen must be a pen object (you could get the pen from one turtle
                      # and then set it to be the pen for another turtle
myTurtle.setPenDown(boolean)  # boolean must be 1 (True) or 0 (False)


MISC:
myTurtle.clearPath()
myTurtle.getHeading()
myTurtle.setHeading(heading)  # heading is a double (floating point number)
myTurtle.getName()
myTurtle.setName(name)  # name is a string

myTurtle.toString() 

myTurtle.setPicture(picture)
myTurtle.getPicture()



Links to this Page