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

This page removed for FERPA compliance
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Simple turtle graphics

import time

# Draw a "circle". Turtle graphics are optimized, so the circle that is
# drawn is really a polygon. REMOVEDwever you can see the turtle change its
# heading one degree at a time.
def circle():
  width = 640
  height = 480
  world = makeWorld(width, height) # Make a "canvas" for the turtle to draw on
  turtle = makeTurtle(world) # Create a turtle in the world.

  # Put the turtle somewhere in the middle of the world before drawing
  penUp(turtle)
  moveTo(turtle, int(width/3), int(height/2))
  penDown(turtle)

  # Now, draw the circle
  for degree in range(0, 360):
    turn(turtle, 1) # Turn one degree at a time
    forward(turtle, 2) # A small circle. One pixel is too small.
    time.sleep(0.05) # So that we can see the turtle doing the drawing


Link to this Page