API Documentation for functions in media.py _ addArc|addArc(picture, startX, startY, width, height, start, angle[, color]):
picture: the picture you want to draw the arc on
startX: the x-coordinate of the center of the arc
startY: the y-coordinate of the center of the arc
width: the width of the arc
height: the height of the arc
start: the start angle of the arc in degrees
angle: the angle of the arc relative to start in degrees
color: the color you want to draw in (optional)
Takes a picture, (x,y) coordinates, width, height, two integer angles, and (optionally) a color as input. Adds an outline of an arc starting at (x,y) at an initial angle of "start" with the given width and height. The angle of the arc itself is "angle", which is relative to "start." Default color is black.
Examples:
def addSemiCircle(picture, startX, startY, radius, start):
  addArc(picture, startX, startY, radius, radius, start, 180)
This will take in a picture, start coordinates, a radius length, and a starting angle and call addArc to draw a black arc with equal width and height.
def addBlueSemiCircle(picture, startX, startY, radius, start):
  addArc(picture, startX, startY, radius, radius, start, 180, blue)
This will take in a picture, start coordinates, a radius length, and a starting angle and call addArc to draw a blue arc with equal width and height. _ addArcFilled|addArcFilled(picture, startX, startY, width, height, start, angle[, color]):
picture: the picture you want to draw the arc on
startX: the x-coordinate of the center of the arc
startY: the y-coordinate of the center of the arc
width: the width of the arc
height: the height of the arc
start: the start angle of the arc in degrees
angle: the angle of the arc relative to start in degrees
color: the color you want to draw in (optional)
Takes a picture, (x,y) coordinates, width, height, two integer angles, and (optionally) a color as input. Adds a filled arc starting at (x,y) at an initial angle of "start" with the given width and height. The angle of the arc itself is "angle", which is relative to "start." Default color is black.
Examples:
def addFilledSemiCircle(picture, startX, startY, radius, start):
  addArcFilled(picture, startX, startY, radius, radius, start, 180)
This will take in a picture, start coordinates, a radius length, and a starting angle and call addArcFilled to draw a filled black arc with equal width and height.
def addBlueFilledSemiCircle(picture, startX, startY, radius, start):
  addArcFilled(picture, startX, startY, radius, radius, start, 180, blue)
This will take in a picture, start coordinates, a radius length, and a starting angle and call addArcFilled to draw a filled blue arc with equal width and height. _ addFrameToMovie|addFrameToMovie(frame, movie):
frame: the filename of the frame to be added to the movie
movie: the movie object for the frame to be added to
Takes a filename and a Movie object as input. Adds the file as a frame to the end of the movie. addFrameToMovie(movie, frame) is also acceptable.
Example:
def addFileToMovie(movie):
  picture = pickAFile()
  addFrameToMovie(picture, movie)
This will allow the user to choose the filename of a picture, and add that picture as the last frame in the specified movie. _ addLine|addLine(picture, startX, startY, endX, endY[, color]):
picture: the picture you want to draw the line on
startX: the x position you want the line to start
startY: the y position you want the line to start
endX: the x position you want the line to end
endY: the y position you want the line to end
color: the color you want to draw in (optional)
Takes a picture, a starting (x, y) position (two numbers), and an ending (x, y) position (two more numbers, four total), and (optionally) a color as input. Adds a line from the starting point to the ending point in the picture. Default color is black.
Examples:
def drawVertical(picture):
  addLine(picture, 100, 20, 100, 250)
This will take in a picture and draw a black vertical line on it from (100,20) to (100,250)
def drawDiagonal(picture):
  addLine(picture, 0, 15, 100, 115, blue)
This will take in a picture and draw a blue diagonal line on it from (0,15) to (100, 115). _ addOval|addOval(picture, startX, startY, width, height[, color]):
picture: the picture you want to draw the oval on
startX: the x-coordinate of the upper left-hand corner of the bounding rectangle of the oval
startY: the y-coordinate of the upper left-hand corner of the bounding rectangle of the oval
width: the width of the oval
height: the height of the oval
color: the color you want to draw in (optional)
Takes a picture, a starting (x, y) position (two numbers), a width and height (two more numbers, four total), and (optionally) a color as input. Adds an oval outline of the given dimensions using the (x,y) as the upper left corner of the bounding rectangle. Default color is black.
Examples:
def addCircle(picture, startX, startY, radius):
  addOval(picture, startX, startY, radius, radius)
This will take in a picture, start coordinates, and a radius length and call addOval to draw a black oval with equal width and height.
def addBlueCircle(picture, startX, startY, radius):
  addOval(picture, startX, startY, radius, radius, blue)
This will take in a picture, start coordinates, and a radius length and call addOval to draw a blue oval with equal width and height. _ addOvalFilled|addOvalFilled(picture, startX, startY, width, height[, color]):
picture: the picture you want to draw the oval on
startX: the x-coordinate of the upper left-hand corner of the bounding rectangle of the oval
startY: the y-coordinate of the upper left-hand corner of the bounding rectangle of the oval
width: the width of the oval
height: the height of the oval
color: the color you want to draw in (optional)
Takes a picture, a starting (x, y) position (two numbers), a width and height (two more numbers, four total), and (optionally) a color as input. Adds a filled oval of the given dimensions using the (x,y) as the upper left corner of the bounding rectangle. Default color is black.
Examples:
def addCircleFilled(picture, startX, startY, radius):
  addOvalFilled(picture, startX, startY, radius, radius)
This will take in a picture, start coordinates, and a radius length and call addOvalFilled to draw a solid oval with equal width and height.
def addBlueCircleFilled(picture, startX, startY, radius):
  addOvalFilled(picture, startX, startY, radius, radius, blue)
This will take in a picture, start coordinates, and a radius length and call addOvalFilled to draw a solid blue oval with equal width and height. _ addRect|addRect(picture, startX, startY, width, height[, color]):
picture: the picture you want to draw the rectangle on
startX: the x-coordinate of the upper left-hand corner of the rectangle
startY: the y-coordinate of the upper left-hand corner of the rectangle
width: the width of the rectangle
height: the height of the rectangle
color: the color you want to draw in (optional)
Takes a picture, a starting (x, y) position (two numbers), a width and height (two more numbers, four total), and (optionally) a color as input. Adds a rectangular outline of the specified dimensions using the (x,y) as the upper left corner. Default color is black.
Examples:
def addSquare(picture, startX, startY, edge):
  addRect(picture, startX, startY, edge, edge)
This will take in a picture, start coordinates, and an edge length and call addRect to draw a black rectangle with all sides the same length.
def addBlueSquare(picture, startX, startY, edge):
  addRect(picture, startX, startY, edge, edge, blue)
This will take in a picture, start coordinates, and an edge length and call addRect to draw a blue rectangle with all sides the same length. _ addRectFilled|addRectFilled(picture, startX, startY, width, height[, color]):
picture: the picture you want to draw the rectangle on
startX: the x-coordinate of the upper left-hand corner of the rectangle
startY: the y-coordinate of the upper left-hand corner of the rectangle
width: the width of the rectangle
height: the height of the rectangle
color: the color you want to draw in (optional)
Takes a picture, a starting (x, y) position (two numbers), a width and height (two more numbers, four total), and (optionally) a color as input. Adds a filled rectangle of the specified dimensions using the (x,y) as the upper left corner. Default color is black.
Examples:
def addSquareFilled(picture, startX, startY, edge):
  addRectFilled(picture, startX, startY, edge, edge)
This will take in a picture, start coordinates, and an edge length and call addRectFilled to draw a solid black rectangle with all sides the same length.
def addBlueSquareFilled(picture, startX, startY, edge):
  addRectFilled(picture, startX, startY, edge, edge, blue)
This will take in a picture, start coordinates, and an edge length and call addRectFilled to draw a solid blue rectangle with all sides the same length. _ addText|addText(picture, xpos, ypos, text[, color]):
picture: the picture you want to add the text to
xpos: the x-coordinate where you want to start writing the text
ypos: the y-coordinate where you want to start writing the text
text: a string containing the text you want written
color: the color you want to draw in (optional)
Takes a picture, an x position and a y position (two numbers), and some text as a string, which will get drawn into the picture, in the specified color. Default color is black.
Examples:
def addDate(picture):
  str = "Today is the first day of the rest of your life."
  addText(picture, 0, 0, str)
This takes in a picture and adds a black date stamp to the upper left corner.
def addHappyBirthday(picture):
  str = "Happy Birthday!!!"
  addText(picture, 0, 0, str, orange)
This takes in a picture and adds an orange Happy Birthday message to the upper left corner.
_ addTextWithStyle|addTextWithStyle(picture, xpos, ypos, text, style[, color]):
picture: the picture you want to add the text to
xpos: the x-coordinate where you want to start writing the text
ypos: the y-coordinate where you want to start writing the text
text: a string containing the text you want written
style: a font created using makeStyle()
color: the color you want to draw in (optional)
Takes a picture, an x position and a y position (two numbers), and some text as a string, which will get drawn into the picture, in the given font style and specified color. Default color is black.
Examples:
def addDate(picture):
  import java.awt.Font as Font
  str = "Today is the first day of the rest of your life."
  myFont = makeStyle("Comic Sans", Font.BOLD, 96)
  addTextWithStyle(picture, 0, 0, str, myFont)
This takes in a picture and adds a black date stamp to the upper left corner in Size 96 bold Comic Sans.
def addHappyBirthday(picture):
  import java.awt.Font as Font
  str = "Happy Birthday!!!"
  myFont = makeStyle("Wingdings", Font.ITALICS, 24)
  addText(picture, 0, 0, str, orange)
This takes in a picture and adds an orange Happy Birthday message to the upper left corner in Size 24 italcized Wingdings.
_ backward|backward(turtle[, distance]):
turtle: the turtle to operate on
distance: how far to go, in pixels (optional)
Moves the turtle opposite to the direction it's facing. Default distance is 100 pixels.
Example
def moveTurtleBackward50():
  w = makeWorld()
  t = makeTurtle(w)
  backward(t, 50)
This creates a new turtle and moves it backward 50 pixels.
def moveTurtleBackward100():
  w = makeWorld()
  t = makeTurtle(w)
  backward(t)
This creates a new turtle and moves it backward the default number of pixels (100). _ blockingPlay|blockingPlay(sound):
sound: the sound that you want to play
Plays the sound provided as input, and makes sure that no other sound plays at the exact same time. (Try two play's right after each other.)
Example:
def playSoundTwice():
  sound = makeSound(r"C:\My Sounds\preamble.wav")
  blockingPlay(sound)
  blockingPlay(sound)
This will play the preamble.wav twice, back-to-back. _ copyInto|copyInto(smallPicture, bigPicture, startX, startY):
smallPicture: the picture to paste into the big picture
bigPicture: the picture to be modified
startX: the X coordinate of where to place the small picture on the big one
startY: the Y coordinate of where to place the small picture on the big one
Takes two pictures, a x position and a y position as input, and modifies bigPicture by copying into it as much of smallPicture as will fit, starting at the x,y position in the destination picture.
Example:
def addBorder(picture, borderWidth, borderHeight, borderColor):
  canvas = makeEmptyPicture( getWidth(picture) + 2*borderWidth, getHeight(picture) + 2*borderHeight, borderColor )
  copyInto(picture, canvas, borderWidth, borderHeight)
  return canvas
This will take in a picture, and return a new picture which is the original plus a border of specified size and color. _ distance|distance(color1, color2):
color1: the first color you want compared
color2: the second color you want compared
returns: a floating point number representing the Cartesian distance between the colors
Takes two Color objects and returns a single number representing the distance between the colors. The red, green, and blue values of the colors are taken as a point in (x, y, z) space, and the Cartesian distance is computed.
Example:
def showDistRedAndBlue():
  red = makeColor(255, 0, 0)
  blue = makeColor(0, 0, 255)
  print distance(red, blue)
This will print the distance between red and blue, 360.62445840513925. _ drop|drop(turtle, picture):
turtle: the turtle that will do the dropping
picture: the picture that the turtle will drop
The turtle drops a picture where it is currently sitting, rotated so that the top of the picture points where the turtle is facing. This, for example, is one way to flip a picture upside-down.
Example:
def dropUpsidedownPic():
  w = makeWorld()
  t = makeTurtle(w)
  moveTo(t, 640, 480)
  pic = makePicture(pickAFile())
  turn(t, 180)
  drop(t, pic)
This allows the user to select a picture file, moves the turtle and drops the picture upside-down. The upper-left corner of the picture will be placed in the lower-right corner of the world. _ duplicatePicture|duplicatePicture(pic):
pic: the picture that you want to duplicate
returns: a new picture object with the same image as the original
Takes a picture as input and returns a new picture object with the same image as the original.
Example:
file = pickAFile()
mypic = makePicture(file)
copyofmypic = duplicatePicture(mypic)
This opens up a file chooser, makes a Picture object using the chosen file, and then creates a second Picture object by copying the first one. _ duplicateSound|duplicateSound(sound):
sound: the sound you want to duplicate
returns: a new Sound object with the same Sample values as the original
Takes a sound as input and returns a new Sound object with the same Sample values as the original.
Example:
file = pickAFile()
mysound = makeSound(file)
copyofmysound = duplicateSound(mysound)
This opens up a file chooser, makes a Sound object using the chosen file, and then creates a second Sound object by copying the first one. _ explore|explore(someMedia):
someMedia: A Picture, Sound, or Movie that you want to view using Media Tools.
Example:
def exploreAPicture():
  file = pickAFile()
  pic = makePicture(file)
  explore(pic)
This creates a Picture object from a file and opens it in the Media Tools. _ forward|forward(turtle[, distance]):
turtle: the turtle to operate on
distance: how far to go, in pixels (optional)
Moves the turtle in the direction it's facing. Default distance is 100 pixels.
Example
def moveTurtleForward50():
  w = makeWorld()
  t = makeTurtle(w)
  forward(t, 50)
This creates a new turtle and moves it forward 50 pixels.
def moveTurtleForward100():
  w = makeWorld()
  t = makeTurtle(w)
  forward(t)
This creates a new turtle and moves it forward the default number of pixels (100). _ getAllPixels|getAllPixels(picture):
picture: the picture you want to get the pixels from
returns: a list of all the pixels in the picture
Takes a picture as input and returns the sequence of Pixel objects in the picture. (Same as getPixels)
Example:
def getTenthPixel(picture):
  pixels = getAllPixels(picture)
  return pixels[9]
This takes in a picture and returns the 10th pixel in that picture. _ getBlue|getBlue(pixel):
pixel: the pixel you want to get the amount of blue from
returns: the blue value of the pixel
Takes a Pixel object and returns the value (between 0 and 255) of the amount of blueness in that pixel.
Example:
def getHalfBlue(pixel):
  blue = getBlue(pixel)
  return blue / 2
This takes in a pixel and returns the amount of blue in that pixel divided by two. _ getColor|getColor(pixel):
pixel: the pixel you want to extract the color from
returns: the color of the pixel
Takes a Pixel and returns the Color object at that pixel.
Example:
def getDistanceFromRed(pixel):
  red = makeColor(255, 0, 0)
  col = getColor(pixel)
  return distance(red, col)
This takes in a pixel and returns that pixel's color's distance from red. _ getColorWrapAround|getColorWrapAround():
returns: a boolean (1/true or 0/false) for the current value of ColorWrapAround
Takes no input, and returns the current value of ColorWrapAround. If it is true, color values will wrap-around (356 mod 256 = 100); if false, color values lower than 0 will be forced to 0 and higher than 255 forced to 255. Default is false.
If setColorWrapAround has not been used since re-saving options or restarting JES, This will return the value in the JES options menu. Otherwise, it will return the last flag specified in setColorWrapAround(flag).
Example:
def setColorWithoutWrap(pixel, r, g, b):
  oldWrapVal = getColorWrapAround()
  setColorWrapAround(0)
  setColor( pixel, makeColor(r, g, b) )
  setColorWrapAround(oldWrapVal)
This will temporarily disable colorWrapAround (if enabled), change the pixel's color, and then restore the colorWrapAround to the initial value. _ getDuration|getDuration(sound):
sound: the sound you want to find the length of (in seconds)
returns: the number of seconds the sound lasts
Takes a sound as input and returns the number of seconds that sound lasts.
Example:
def songLength():
  sound = makeSound(r"C:\My Sounds\2secondsong.wav")
  print getDuration(sound)
This will print out the number of seconds in the sound. For a song with 88000 samples at 44kHz, it will print out "2.0" _ getGreen|getGreen(pixel):
pixel: the pixel you want to get the amount of green from
returns: the green value of the pixel
Takes a Pixel object and returns the value (between 0 and 255) of the amount of greenness in that pixel.
Example:
def getHalfGreen(pixel):
  green = getGreen(pixel)
  return green / 2
This takes in a pixel and returns the amount of green in that pixel divided by two. _ getHeading|getHeading(turtle):
turtle: the turtle to get the heading of
returns: a floating point number representing the heading of the turtle
Returns the degrees of the direction the turtle is facing. (0 degrees is straight up, and heading increases clockwise)
Example:
def turtleRightTriangleAngle():
  w = makeWorld()
  t = makeTurtle(w)
  t2 = makeTurtle(w)
  turnRight(t2)
  forward(t2)
  turnLeft(t2)
  forward(t2, 50)
  turnToFace(t, t2)
  return getHeading(t)
This will calculate the larger of the two acute angles in the right triangle with side lengths 50 and 100 using turtles. (~63.43 degrees) _ getHeight|getHeight(picture):
picture: the picture you want to get the height of
returns: the height of the picture
Takes a picture as input and returns its length in the number of pixels top-to-bottom in the picture.
Example:
def howTall(picture)
  height = getHeight(picture)
  print "The picture is " + str(height) + " pixels tall."
This takes in a picture and prints a descriptive message about its height. _ getLength|getLength(sound):
sound: the sound you want to find the length of (how many samples it has)
returns: the number of samples in sound
Takes a sound as input and returns the number of samples in that sound.
Example:
def songLength():
  sound = makeSound(r"C:\My Sounds\2secondsong.wav")
  print getLength(sound)
This will print out the number of samples in the sound. For a 2 second song at 44kHz, it will print out 88000. _ getMediaFolder|getMediaFolder(filename):
filename: the name of the file you want (optional)
returns: the complete path to the file specified
This function builds the whole path to the file you specify, as long as you've already used setMediaFolder() or setMediaPath() to pick out the place where you keep your media. If no filename is given, only the MediaFolder will be returned.
Example:
def getFullPathToMarysSong():
  setMediaFolder("C:\\")
  return getMediaFolder("MarysSong.wav")
This set the MediaFolder to C:\ and will return the full path of MarysSong.wav ('C:\\MarysSong.wav').
def getAndSetMediaFolder():
  setMediaFolder("C:\\")
  return getMediaFolder()
This set the MediaFolder to C:\ and will then return it ('C:\\'). _ getMediaPath|getMediaPath(filename):
filename: the name of the file you want (optional)
returns: the complete path to the file specified
This function builds the whole path to the file you specify, as long as you've already used setMediaFolder() or setMediaPath() to pick out the place where you keep your media. If no filename is given, only the MediaPath will be returned. (Same as getMediaFolder)
Example:
def getFullPathToMarysSong():
  setMediaPath("C:\\")
  return getMediaPath("MarysSong.wav")
This set the MediaPath to C:\ and will return the full path of MarysSong.wav ('C:\\MarysSong.wav').
def getAndSetMediaPath():
  setMediaPath("C:\\")
  return getMediaPath()
This set the MediaPath to C:\ and will then return it ('C:\\'). _ getNumSamples|getNumSamples(sound):
sound: the sound you want to find the length of (how many samples it has)
returns: the number of samples in sound
Takes a sound as input and returns the number of samples in that sound.
Example:
def songLength():
  sound = makeSound(r"C:\My Sounds\2secondsong.wav")
  print getNumSamples(sound)
This will print out the number of samples in the sound. For a 2 second song at 44kHz, it will print out 88000. _ getPixel|getPixel(picture, xpos, ypos):
picture: the picture you want to get the pixel from
xpos: the x-coordinate of the pixel you want
ypos: the y-coordinate of the pixel you want
Takes a picture, an x position and a y position (two numbers), and returns the Pixel object at that point in the picture. (Same as getPixelAt)
Example:
def getUpperLeftPixel(picture)
  return getPixel(picture, 0, 0)
This will take in a picture and return the pixel in the upper left-hand corner, (0, 0). _ getPixelAt|getPixelAt(picture, xpos, ypos):
picture: the picture you want to get the pixel from
xpos: the x-coordinate of the pixel you want
ypos: the y-coordinate of the pixel you want
Takes a picture, an x position and a y position (two numbers), and returns the Pixel object at that point in the picture.
Example:
def getUpperLeftPixel(picture)
  return getPixelAt(picture, 0, 0)
This will take in a picture and return the pixel in the upper left-hand corner, (0, 0). _ getPixels|getPixels(picture):
picture: the picture you want to get the pixels from
returns: a list of all the pixels in the picture
Takes a picture as input and returns the sequence of Pixel objects in the picture.
Example:
def getTenthPixel(picture):
  pixels = getPixels(picture)
  return pixels[9]
This takes in a picture and returns the 10th pixel in that picture. _ getRed|getRed(pixel):
pixel: the pixel you want to get the amount of red from
returns: the red value of the pixel
Takes a Pixel object and returns the value (between 0 and 255) of the amount of redness in that pixel.
Example:
def getHalfRed(pixel):
  red = getRed(pixel)
  return red / 2
This takes in a pixel and returns the amount of red in that pixel divided by two. _ getSampleObjectAt|getSampleObjectAt(sound, index):
sound: the sound you want to get the sample from
index: the index of the sample you want to get
returns: the sample object at that index
Takes a sound and an index (an integer value), and returns the Sample object at that index.
Example:
def getTenthSample(sound):
  samp = getSampleObjectAt(sound, 9)
  return samp
This takes a sound, and returns the 10th sample in the sound. _ getSamples|getSamples(sound):
sound: A Sound, the sound you want to extract the samples from
returns: A collection of all the samples in the sound
Takes a sound as input and returns the Samples in that sound.
Example:
def printFirstTen(sound):
  samps = getSamples(sound)
  for num in range(0, 10):
    print samps[num]
This will take in a sound and print the first 10 samples in that sound _ getSampleValue|getSampleValue(sample):
sample: a sample of a sound
returns: the integer value of that sample
Takes a Sample object and returns its value (between -32768 and 32767). (Formerly getSample)
Example:
def sampleToInt(sample):
  return getSampleValue(sample)
This will convert a sample object into an integer. _ getSampleValueAt|getSampleValueAt(sound, index):
sound: the sound you want to get the sample from
index: the index of the sample you want to get the value of
Takes a sound and an index (an integer value), and returns the value of the sample (between -32768 and 32767) for that object.
Example:
def getTenthSampleValue(sound):
  num = getSampleValueAt(sound, 9)
  return num
This will take in a sound and return the integer value of the tenth sample _ getSamplingRate|getSamplingRate(sound):
sound: the sound you want to get the sampling rate from
returns: the integer value representing the number of samples per second
Takes a sound as input and returns the number representing the number of samples in each second for the sound.
Example:
def getDoubleSamplingRate(sound):
  rate = getSamplingRate(sound)
  return (rate * 2)
This will take in a sound an return the sampling rate multiplied by 2. _ getShortPath|getShortPath(path):
path: a path to a file, as a string
returns: a shorter, non-absolute version of that path
Takes a file path as input and returns the short version of that path.
Example:
print getShortPath("c:\\images\\kittens\\fluffy.jpg")
This will print the short path of "c:\images\kittens\fluffy.jpg" which is "kittens\fluffy.jpg". _ getSound|getSound(sample):
sample: a sample belonging to a sound
return: the sound the sample belongs to
Takes a Sample object and returns the Sound that it belongs to.
Example:
def getSamplesFromAnySample(sample):
  sound = getSound(sample)
  return getSamples(sound)
This will take in a sample and return the list of samples from the original sound. _ getTurtleList|getTurtleList(world):
world: the world to get the turtles from
returns: the list of turtles in the world
Returns a list of all turtles in the specified world. (You could, for example, tell each one to do something)
Example:
def turtleDuel():
  w = makeWorld()
  t = makeTurtle(w)
  t2 = makeTurtle(w)
  turn(t2, 180)
  for turtle in getTurtleList(w):
    forward(turtle, 50)
    turn(turtle, 180)
This creates a world with two turtles. The second turtle turns around 180 degrees, then both turtles move forward 50 pixels and turn to face each other. _ getWidth|getWidth(picture):
picture: the picture you want to get the width of
returns: the width of the picture
Takes a picture as input and returns its length in the number of pixels left-to-right in the picture.
Example:
def howWide(picture)
  width = getWidth(picture)
  print "The picture is " + str(width) + " pixels wide."
This takes in a picture and prints a descriptive message about its width. _ getX|getX(pixel):
pixel: the pixel you want to find the x-coordinate of
returns: the x-coordinate of the pixel
Takes in a pixel object and returns the x position of where that pixel is in the picture.
Example:
def getHalfX(pixel):
  pos = getX(pixel)
  return pos / 2
This will take in a pixel and return half of its x-coordinate. _ getXPos|getXPos(turtle):
turtle: the turtle to get the x position of
returns: the x position of the turtle
Returns the x coordinate of the turtle's location.
Example:
def getDefaultTurtleXPos():
  w = makeWorld()
  todd = makeTurtle(w)
  return getXPos(todd)
This will create a world of default size (640x480), place a turtle in the center, and return its x position (320). _ getY|getY(pixel):
pixel: the pixel you want to find the y-coordinate of
returns: the y-coordinate of the pixel
Takes in a pixel object and returns the y position of where that pixel is in the picture.
Example:
def getHalfY(pixel):
  pos = getY(pixel)
  return pos / 2
This will take in a pixel and return half of its y-coordinate. _ getYPos|getYPos(turtle):
turtle: the turtle to get the y position of
returns: the y position of the turtle
Returns the y coordinate of the turtle's location.
Example:
def getDefaultTurtleYPos():
  w = makeWorld()
  timmy = makeTurtle(w)
  return getYPos(timmy)
This will create a world of default size (640x480), place a turtle in the center, and return its y position (240). _ makeBrighter|makeBrighter(color):
color: the color you want to lighten
returns: the new, lighter color
Takes a color and returns a slightly lighter version of the original color. (Same as makeLighter)
Example:
def makeMuchBrighter(color):
  return makeBrighter(makeBrighter(makeBrighter(color)))
Takes in a color and returns a much lighter version of it by calling makeBrighter three times. _ makeColor|makeColor(red[, green, blue]):
red: the amount of red you want in the color (or a Color object you want to duplicate)
green: the amount of green you want in the color (optional)
blue: the amount of blue you want in the picture (optional)
returns: the color made from the inputs
Takes three integer inputs for the red, green, and blue components (in order) and returns a color object. If green and blue are omitted, the red value is used as the intensity of a gray color. Also it works with only a color as input and returns a new color object with the same RGB values as the original.
Examples:
def makeCyan():
  return makeColor(0, 255, 255)
This will return the color cyan.
def makeGrey(amount):
  return makeColor(amount, amount, amount)
This will take in an amount and make a grey color based on that.
def duplicateColor(color):
  return makeColor(amount, amount, amount)
This will take in a color and return a duplicate color object. _ makeDarker|makeDarker(color):
color: the color you want to darken
returns: the new, darker color
Takes a color and returns a slightly darker version of the original color.
Example:
def makeMuchDarker(color):
  return makeDarker(makeDarker(makeDarker(color)))
Takes in a color and returns a much darker version of it by calling makeDarker three times. _ makeEmptyPicture|makeEmptyPicture(width, height[, color]):
width: the width of the empty picture
height: height of the empty picture
color: background color of the empty picture (optional)
returns: a new picture object with all the pixels set to the specified color
Makes a new "empty" picture and returns it to you. The width and height must be between 0 and 10000. Default color is white.
Examples:
def makeEmptySquare(edge):
  return makeEmptyPicture(edge, edge)
This will take in an edge length and call makeEmptyPicture to return an empty white picture all sides the same length.
def makeEmptyBlueSquare(edge):
  return makeEmptyPicture(edge, edge, blue)
This will take in an edge length and call makeEmptyPicture to return an empty blue picture all sides the same length. _ makeEmptySound|makeEmptySound(numSamples[, samplingRate]):
numSamples: the number of samples in the sound
samplingRate: the integer value representing the number of samples per second (optional)
returns: an empty sound with the given number of samples and sampling rate
Takes one or two integers as input. Returns an empty Sound object with the given number of samples and (optionally) the given sampling rate. Default rate is 22050 bits/second. The resulting sound must not be longer than 600 seconds. Prints an error statement if numSamples or samplingRate are less than 0, or if (numSamples/samplingRate) > 600.
Examples:
def make10SecondSound():
  return makeEmptySound(10 * 22050)
This will return an empty sound lasting 10 seconds long, using the default sampling rate (22050 bits/second).
def make10SecondSoundWithSamplingRate(samplingRate):
  return makeEmptySound(10 * samplingRate, samplingRate)
This will return an empty sound lasting 10 seconds long, using the given sampling rate. _ makeEmptySoundBySeconds|makeEmptySoundBySeconds(duration[, samplingRate]):
duration: the time in seconds for the duration of the sound
samplingRate: the integer value representing the number of samples per second of sound (optional)
returns: An Empty Sound.
Takes a floating point number and optionally an integer as input. Returns an empty Sound object of the given duration and (optionally) the given sampling rate. Default rate is 22050 bits/second. If the given arguments do not multiply to an integer, the number of samples is rounded up. Prints an error statement if duration or samplingRate are less than 0, or if duration > 600.
Examples:
def make10SecondSound():
  return makeEmptySoundBySeconds(10)
This will return an empty sound lasting 10 seconds long, using the default sampling rate (22050 bits/second).
def make10SecondSoundWithSamplingRate(samplingRate):
  return makeEmptySoundBySecons(10, samplingRate)
This will return an empty sound lasting 10 seconds long, using the given sampling rate. _ makeLighter|makeLighter(color):
color: the color you want to lighten
returns: the new, lighter color
Takes a color and returns a slightly lighter version of the original color. This does the same thing as makeBrighter(color).
Example:
def makeMuchLighter(color):
  return makeLighter(makeLighter(makeLighter(color)))
Takes in a color and returns a much lighter version of it by calling makeLighter three times. _ makeMovie|makeMovie():
returns: an empty Movie object.

Example:
def makeSingleFramedMovie():
  picture = pickAFile()
  movie = makeMovie()
  addFrameToMovie(picture, movie)
  return movie
This will allow the user to choose the filename of a picture, and add that picture as the only frame to a new movie. The single framed movie is then returned. _ makeMovieFromInitialFile|makeMovieFromInitialFile(filename):
filename: string path to the first frame of the movie.
returns: a Movie object using the given file as the first frame
Takes a filename as input. Returns a Movie object using the given file as the first frame and using sequentially named files for subsequent frames (i.e. frame001, frame002, etc.)
Example:
def createNewMovie():
  file = pickAFile()
  return makeMovieFromInitialFile(file)
This opens up a file selector dialog. The user picks a picture file, and the function returns a Movie with the given file as the first frame. _ makePicture|makePicture(path):
path: the name of the file you want to open as a picture
returns: a picture object made from the file
Takes a filename as input, reads the file, and creates a picture from it. Returns the picture.
Example:
def makePictureSelector():
    file = pickAFile()
    return makePicture(file)
This function will open a file selector box and then return the picture object made from that file. _ makeSound|makeSound(path):
path: a string path of a wav file
returns: the sound created from the file at the given path
Takes a filename as input, reads the file, and creates a sound from it. Returns the sound.
Example:
def openAnySound():
  file = pickAFile()
  return makeSound(file)
This opens up a file selector dialog. The user picks a file, and the function returns it as a sound. _ makeStyle|makeStyle(fontName, emphasis, size):
fontName: the name of the font you want in the style (sansSerif, serif, mono)
emphasis: the type of emphasis you want in the style (italic, bold, italic + bold, plain)
size: the size of the font you want in the style
returns: the style made from the inputs
Takes a font name, emphasis, and size in points as input. Returns a Font object with the given parameters.
Example:
def makeBold12ptSerifFont():
  return makeStyle(sansSerif, bold, 12)
This takes no input and will return a Font that is san-serif, bold, and of size 12pt. _ makeTurtle|makeTurtle(world):
world: a world to put the turtle in
returns: the new turtle
Makes a turtle and returns it
Example:
def turtleForward():
  w = makeWorld()
  t = makeTurtle(w)
  forward(t)
This creates a new turtle and moves it forward 100 pixels. _ makeWorld|makeWorld([width, height]):
width: the width for your new world (optional)
height: the height for your new world (optional)
returns: the new world
Returns a new world of the specified size, where you can put turtles. Default size is 640x480.
Example:
def makeDefaultWorld():
  earth = makeWorld()
This creates a world with the default size (640x480).
def makeSmallerWorld():
  mars = makeWorld(500, 500)
This creates a smaller world of size 500x500. _ moveTo|moveTo(turtle, x, y):
turtle: the turtle to operate on
x: the x coordinate in the world to move to
y: the y coordinate in the world to move to
Moves the turtle to the specified location. If the turtle's pen is down, it draws a line from its old position to the new one.
Example:
def moveTurtleTo():
  w = makeWorld()
  t = makeTurtle(w)
  moveTo(t, 150, 150)
This will create a new turtle and move it to the coordinates (150,150) in the world. _ openFrameSequencerTool|openFrameSequencerTool(movie)
movie: the movie that you want to examine
Opens the Frame Sequencer Tool explorer, which lets you examine and manipulate the frames of a movie.
Example:
def frameSequenceNewMovie():
  file = pickAFile()
  openFrameSequencerTool(makeMovieFromInitialFile(file))
This opens up a file selector dialog. The user picks a picture file, and the Movie with the given file as the first frame is loaded into the Frame Sequencer Tool. _ openPictureTool|openPictureTool(picture)
picture: the picture that you want to examine
Opens the Picture Tool explorer, which lets you examine the pixels of an image.
Example:
def openFileInPictureTool():
  file = pickAFile()
  pic = makePicture(file)
  openPictureTool(pic)
This opens up a file selector dialog. The user picks an image file, and it is loaded into the Picture Tool. _ openSoundTool|openSoundTool(sound)
sound : the sound that you want to examine
Opens the Sound Tool explorer, which lets you examine the waveform of a sound.
Example:
def openFileInSoundTool():
  file = pickAFile()
  sound = makeSound(file)
  openSoundTool(sound)
This opens up a file selector dialog. The user picks a sound file, and it is loaded into the Sound Tool. _ penDown|penDown(turtle):
turtle: the turtle to operate on
Makes it so the turtle leaves a trail when it moves. Default is down.
Example:
def turtleSquare():
  w = makeWorld()
  t = makeTurtle(w)
  for x in range(0,4):
    penUp(t)
    forward(t)
    turnRight(t)
    penDown(t)
    forward(t)
This will create a turtle and draw a 200x200 square with only half of each edge showing. _ penUp|penUp(turtle):
turtle: the turtle to operate on
Makes it so the turtle does not leave a trail when it moves. Default is down.
Example:
def turtleSquare():
  w = makeWorld()
  t = makeTurtle(w)
  for x in range(0,4):
    penUp(t)
    forward(t)
    turnRight(t)
    penDown(t)
    forward(t)
This will create a turtle and draw a 200x200 square with only half of each edge showing. _ pickAColor|pickAColor():
returns: the color chosen in the dialog box
Opens a color chooser to let the user pick a color and returns it. Takes no input.
Example:
def makeColoredPicture():
  color = pickAColor()
  return makeEmptyPicture(100, 100, color)
This opens up a color selector dialog, then the user picks a color, and the function returns a 100x100 picture of the chosen color. _ pickAFile|pickAFile():
returns: the string path to the file chosen in the dialog box
Opens a file chooser to let the user pick a file and returns the complete path name as a string. Takes no input.
Example:
def openAnySound():
  file = pickAFile()
  return makeSound(file)
This opens up a file selector dialog, then the user picks a file, and the function returns it as a sound. _ pickAFolder|pickAFolder():
returns: the string path to the folder chosen in the dialog box
Opens a file chooser to let the user pick a folder and returns the complete path name as a string. Takes no input.
Example:
def showFolderContents():
  folder = pickAFolder()
  import os
  print os.listdir(folder)
This opens up a file selector dialog, then the user picks a folder, and the function prints the contents of that folder. _ play|play(sound):
sound: the sound you want to be played
Plays a sound provided as input. No return value.
Example:
def playAnySound():
  file = pickAFile()
  sound = makeSound(file)
  play(sound)
This will open up a file selector box, make a sound from the chosen file, and then play that sound back. _ playMovie|playMovie(movie):
movie: the movie object to be played
Takes a Movie object as input and plays it.
Example:
def playMyMovie():
  myMovie = makeMovieFromInitialFile(r"C:\mymovie\frame001.jpg")
  playMovie(myMovie)
This will create a movie with starting frame "C:\mymovie\frame001.jpg" and then play the movie. _ playNote|playNote(note, duration[, intensity]):
note: the MIDI note number, from 0 to 127 (60 = Middle C) you want to be played
duration: the duration you want the note to be played in milliseconds
intensity: the intensity (a number between 0 and 127) you want the note to be played (optional)
Plays the given note. No return value. Default intensity is 64.
Example:
def playScale():
  intensity = 64
  dur = 1000
  playNote(60, dur, intensity)
  playNote(62, dur, intensity)
  playNote(64, dur, intensity)
  playNote(65, dur, intensity)
  playNote(67, dur, intensity)
  playNote(69, dur, intensity)
  playNote(71, dur, intensity)
  playNote(72, dur, intensity)
This will play a scale with one second notes and default intensity. _ printNow|printNow(output):
output: What we want to print
Prints the specified output to the JES command area right now, without waiting for buffering. Helpful for debugging, if your program is throwing an exception!
Example:
def lineByLine():
  for x in range(1, 101)
  	printNow(x)
This will print the numbers 1 to 100 in order. Compare with using "print". _ quit|quit():
Forces JES to stop running the current program.
Example:
def quitTest():
  for x in range(1, 101):
    printNow(x)
    if x == 50:
      quit()
This will print the numbers 1 to 50 in order and then stop. _ repaint|repaint(picture):
picture: the picture you want to repaint
Repaints the picture if it has been opened in a window from show(picture), otherwise a new window will be opened.
Example:
def openShowAddOval():
  file = pickAFile()
  pic = makePicture(file)
  show(pic)
  addOval(pic, 0, 0, getWidth(pic), getHeight(pic))
  repaint(pic)
This will let the user choose which file to be shown. Then a black oval will be drawn over the image, and it will be repainted. _ requestInteger|requestInteger(message):
message: the message to display to the user in the dialog
returns: the number as an integer This will allow the user to input an integer. The dialog will keep appearing until a valid integer is entered.
Example:
def printAge():
  age = requestInteger("How old are you?")
  print "You are " + str(age) + " years old!"
This will open a dialog box asking the user's age and then print it back out. _ requestIntegerInRange|requestIntegerInRange(message, min, max):
message: the message to display to the user in the dialog
min: the smallest integer allowed
max: the largest integer allowed
Opens a message dialog to the user asking for an integer between a minimum and maximum (inclusive). The dialog will keep appearing until a valid integer is entered.
Example:
def guessingGame():
  import random
  r = random.randint(1,10)
  guess = requestIntegerInRange("Guess a number 1-10", 1, 10)
  if guess == r:
    print "You win!"
  else:
    print "You lose!"
This will open a dialog box asking the user to pick a number from 1 to 10. If the chosen number is the same as the randomly generated one, you win) _ requestNumber|requestNumber(message):
message: the message to display to the user in the dialog
returns: the number as a double
This will allow the user to input a number with a decimal. The dialog will keep appearing until a valid number is entered.
Example:
def printHeight():
  dec = requestNumber("How many feet tall are you?")
  feet = floor(dec)
  inch = (dec - feet)*12
  print "You are " + str(feet) + " feet and " + str(inch) + " inches tall."
This will open a dialog box asking the user's height in feet (in decimal form) and then print out the equivalent number of feet and inches. _ requestString|requestString(message):
message: the message to display to the user in the dialog
returns: the input string
This will allow the user to input any string.
Example:
def printName():
  name = requestString("What is your name?")
  print "Hello " + name + "!"
This will open a dialog box asking the user's name and then print it back out. _ setAllPixelsToAColor|setAllPixelsToAColor(picture, color):
picture: the picture to change the pixels of
color: the color to set each pixel to
Modifies the whole image so that every pixel in that image is the given color.
Example:
def makeColoredPicture():
  pic = makeEmptyPicture(100, 100)
  color = pickAColor()
  setAllPixelsToAColor(pic, color)
  return pic
This opens up a color selector dialog, then the user picks a color, and the function returns a 100x100 picture of the chosen color. _ setBlue|setBlue(pixel, blueValue):
pixel: the pixel you want to set the blue value of
blueValue: a number (0 - 255) for the new blue value of the pixel
Takes in a Pixel object and a value (between 0 and 255) and sets the blueness of that pixel to the given value.
Example:
def zeroBlue(pixel):
  setBlue(pixel, 0)
This will take in a pixel and set its amount of blue to 0. _ setColor|setColor(pixel, color):
pixel: the pixel you want to set the color of
color: the color you want to set the pixel to
Takes in a pixel and a color, and sets the pixel to the given color.
Example:
def makeMoreBlue(pixel):
  myBlue = getBlue(pixel) + 60
  newColor = makeColor(getRed(pixel), getGreen(pixel), myBlue)
  setColor(pixel, newColor)
This will take in a pixel and increase its level of blue by 60. _ setColorWrapAround|setColorWrapAround(flag):
flag: a boolean (1/true or 0/false) for the new ColorWrapAround value
Takes a boolean as input. If flag is true, color values will wrap-around (356 mod 256 = 100); if false, color values lower than 0 will be forced to 0 and higher than 255 forced to 255. Default is false.
This only temporarily changes the value. ColorWrapAround will be restored to its value defined in the JES options menu by: Running setColorWrapAround(bool) where bool is the default value, re-saving options, or by restarting JES.
Example:
def setColorWithoutWrap(pixel, r, g, b):
  oldWrapVal = getColorWrapAround()
  setColorWrapAround(0)
  setColor( pixel, makeColor(r, g, b) )
  setColorWrapAround(oldWrapVal)
This will temporarily disable colorWrapAround (if enabled), change the pixel's color, and then restore the colorWrapAround to the initial value. _ setGreen|setGreen(pixel, greenValue):
pixel: the pixel you want to set the green value of
greenValue: a number (0 - 255) for the new green value of the pixel
Takes in a Pixel object and a value (between 0 and 255) and sets the greenness of that pixel to the given value.
Example:
def zeroGreen(pixel):
  setGreen(pixel, 0)
This will take in a pixel and set its amount of green to 0. _ setLibPath|setLibPath([directory]):
directory: a string path to a directory. (optional) If leave this out. If you do, JES will open up a file chooser for you to select a directory yourself.
Allows you to add a directory where JES can look for modules that you want to be able to import.
Example:
def setLibToMediaPath():
  setLibPath(getMediaPath())
This will set the library path to the same directory as the current media path _ setMediaFolder|setMediaFolder:(directory)
directory: The directory you want to set as the media folder.
Takes a directory as input. JES then will look for files in that directory unless given a full path, i.e. one that starts with "c:\". You can leave out the directory. If you do, JES will open up a file chooser to let you select a directory.
Examples:
def openBobsSong():
  setMediaFolder()
  song = makeSound("BobsSong.wav")
  return song
This will let the user set a folder to look for files in, and then open the file "BobsSong.wav" in that folder.
def openMarysSong():
  setMediaFolder("C:\\music")
  song = makeSound("MarysSong.wav")
  return song
This sets the folder to look in to "C:\music", and then open the file "MarysSong.wav" in that folder. _ setMediaPath|setMediaPath:(directory)
directory: The directory you want to set as the media folder.
Takes a directory as input. JES then will look for files in that directory unless given a full path, i.e. one that starts with "c:\". You can leave out the directory. If you do, JES will open up a file chooser to let you select a directory.
Examples:
def openBobsSong():
  setMediaPath()
  song = makeSound("BobsSong.wav")
  return song
This will let the user set a folder to look for files in, and then open the file "BobsSong.wav" in that folder.
def openMarysSong():
  setMediaPath("C:\\music")
  song = makeSound("MarysSong.wav")
  return song
This sets the folder to look in to "C:\music", and then open the file "MarysSong.wav" in that folder. _ setRed|setRed(pixel, redValue):
pixel: the pixel you want to set the red value of
redValue: a number (0 - 255) for the new red value of the pixel
Takes in a Pixel object and a value (between 0 and 255) and sets the redness of that pixel to the given value.
Example:
def zeroRed(pixel):
  setRed(pixel, 0)
This will take in a pixel and set its amount of red to 0. _ setSampleValue|setSampleValue(sample, value):
sample: the sound sample you want to change the value of
value: the value you want to set the sample to
Takes a Sample object and a value (should be between -32768 and 32767), and sets the sample to that value.
Example:
def setTenthSample(sound, value):
  samp = getSampleObjectAt(sound, 9)
  setSampleValue(samp, value)
This takes a sound and an integer, and then sets the value of the 10th sample in the sound to the passed in value. _ setSampleValueAt|setSampleValueAt(sound, index, value):
sound: the sound you want to change a sample in
index: the index of the sample you want to set
value: the value you want to set the sample to
Takes a sound, an index, and a value (should be between -32768 and 32767), and sets the value of the sample at the given index in the given sound to the given value.
Example:
def setTenthToTen(sound):
  setSampleValueAt(sound, 9, 10)
This takes in a sound and sets the value of the 10th sample to 10. _ show|show(picture):
picture: the picture you want to see
Shows the picture provided as input.
Example:
def openShow():
  file = pickAFile()
  pic = makePicture(file)
  show(pic)
This will let the user choose which file to be shown and show it. _ showError|showError(message):
message: the message to show to the user
Opens a message dialog to the user showing an error. _ showInformation|showInformation(message):
message: the message to show to the user
Opens a message dialog to the user showing information. _ showMediaFolder|showMediaFolder():
This functon takes no input and returns nothing, but prints the current MediaFolder as long as you've already used setMediaFolder() or setMediaPath() to pick out the place where you keep your media.
Example:
def printMediaFolder():
  setMediaFolder("C:\\")
  showMediaFolder()
This will print some text, as well as the full path of the current MediaFolder. ("The media path is currently: C:\") _ showWarning|showWarning(message):
message: the message to show to the user
Opens a message dialog to the user showing a warning. _ stopPlaying|stopPlaying(sound):
sound: the sound that you want to stop playing
Stops a sound that is currently playing.
Example:
def playAndStop():
  sound = makeSound(r"C:\My Sounds\preamble.wav")
  play(sound)
  stopPlaying(sound)
This will start playing preamble.wav and stop it immediately after it starts. _ turn|turn(turtle[, degrees]):
turtle: the turtle to operate on
degrees: how many degrees to turn (optional)
Turns the turtle; positive numbers of degrees mean turning to the turtle's right, negative numbers of degrees mean turning to the turtle's left. Default is 90 degrees.
Example:
def turnTurtleRight():
  w = makeWorld()
  t = makeTurtle(w)
  turn(t)
This will create a turtle and turn it right 90 degrees.
def turnTurtleAround():
  w = makeWorld()
  t = makeTurtle(w)
  turn(t, 180)
This will create a turtle and turn it 180 degrees. _ turnLeft|turnLeft(turtle):
turtle: the turtle to operate on
Turns the turtle left 90 degrees.
Example:
def makeLeftSquare():
  w = makeWorld()
  t = makeTurtle(w)
  for x in range(0,4):
    forward(t)
    turnLeft(t)
This will create a turtle and draw a 100x100 square to the upper-left of the middle of the world. _ turnRight|turnRight(turtle):
turtle: the turtle to operate on
Turns the turtle right 90 degrees.
Example:
def makeRightSquare():
  w = makeWorld()
  t = makeTurtle(w)
  for x in range(0,4):
    forward(t)
    turnRight(t)
This will create a turtle and draw a 100x100 square to the upper-right of the middle of the world. _ turnToFace|turnToFace(turtle, x[, y]):
turtle: the turtle to operate on
x: the x coordinate in the world (or a turtle in the world)
y: the y coordinate in the world (optional)
Makes the turtle look towards point (x, y) or towards turtle x if y is unspecified.
Example:
def turtleEscape():
  w = makeWorld()
  t = makeTurtle(w)
  turnToFace(t, 0, 0)
  forward(t, 400)
This creates a turtles which then faces the origin (0,0) and moves forward 400 pixels.
def turtleDuel():
  w = makeWorld()
  t = makeTurtle(w)
  turn(t)
  t2 = makeTurtle(w)
  turn(t2, 180)
  for turtle in getTurtleList(w):
    forward(turtle, 50)
  turnToFace(t, t2)
  turnToFace(t2, t)
This creates a world with two turtles. The first turtle turns 90 degrees and the second turtle turns around 180 degrees. Then both turtles move forward 50 pixels and turn to face each other. _ writeFramesToDirectory|writeFramesToDirectory(movie[, directory]):
movie: the movie object containing the frames to be written
directory: a string path of the directory to write the frames (optional)
Takes a Movie object and (optionally) a string path to a directory as input. Writes the frames of the movie to the given directory. Default directory is the user's home directory.
Example:
def copyMovieFrames():
  movie = makeMovieFromInitialFile(pickAFile())
  writeFramesToDirectory(movie, pickAFolder())
This opens up a file selector dialog followed by a folder selection dialog. The user picks a picture file for the first frame and a directory. The frames are then copied to the chosen directory.

After you write the frames out, you can encode them into a video file with another program. If you are using windows or mac os, you might be able to use quicktime. If you are using linux, you might use mencoder like this (from the manual):
Encode all *.jpg files in the current dir:
 mencoder  "mf://*.jpg" -mf fps=25 -o output.avi -ovc lavc -lavcopts vcodec=mpeg4
_ writePictureTo|writePictureTo(picture, path):
picture: the picture you want to be written out to a file
path: the path to the file you want the picture written to
Takes a picture and a file name (string) as input, then writes the picture to the file as a JPEG, PNG, or BMP. (Be sure to end the filename in ".jpg" or ".png" or ".bmp" for the operating system to understand it well.)
Example:
def writeTempPic(picture):
  file = r"C:\Temp\temp.jpg"
  writePictureTo(picture, file)
This takes in a picture and writes it to C:\Temp\temp.jpg. _ writeQuicktime|writeQuicktime(movie, path[, framesPerSec]):
movie: the Movie object that you want to write out. The frames must either all be in the same directory, or the frames must have been written out to a directory since the last change was made.
path: the path to the file you want the movie written to
framesPerSec: the frame rate for the movie (optional)
Writes a movie out in Quicktime format. Be sure to end the path with ".mov" so that the operating system will understand it properly. Default frame rate is 16.
Examples:
def makeQuicktimeMovie():
  file = pickAFile()
  myMovie = makeMovieFromInitialFile(file)
  writeQuicktime(myMovie, "C:\\myframes\\myMovie.mov")
This opens up a file selector dialog. The user picks a picture file, and the function writes a Movie with the given file as the first frame to "C:\myframes\myMovie.mov" at 16 frames per second.
def makeQuicktimeMovie():
  file = pickAFile()
  myMovie = makeMovieFromInitialFile(file)
  writeQuicktime(myMovie, "C:\\myframes\\myMovie.mov", 30)
This opens up a file selector dialog. The user picks a picture file, and the function writes a Movie with the given file as the first frame to "C:\myframes\myMovie.mov" at 30 frames per second. _ writeAVI|writeAVI(movie, path[, framesPerSec]):
movie: the Movie object that you want to write out. The frames must either all be in the same directory, or the frames must have been written out to a directory since the last change was made.
path: the path to the file you want the movie written to
framesPerSec: the frame rate for the movie (optional)
Writes a movie out in the AVI video format. Be sure to end the path with ".avi" so that the operating system will understand it properly. Default frame rate is 16.
Examples:
def makeAVIMovie():
  file = pickAFile()
  myMovie = makeMovieFromInitialFile(file)
  writeAVI(myMovie, "C:\\myframes\\myMovie.avi")
This opens up a file selector dialog. The user picks a picture file, and the function writes a Movie with the given file as the first frame to "C:\myframes\myMovie.avi" at 16 frames per second.
def makeAVIMovie():
  file = pickAFile()
  myMovie = makeMovieFromInitialFile(file)
  writeAVI(myMovie, "C:\\myframes\\myMovie.avi", 30)
This opens up a file selector dialog. The user picks a picture file, and the function writes a Movie with the given file as the first frame to "C:\myframes\myMovie.avi" at 30 frames per second. _ writeSoundTo|writeSoundTo(sound, path):
sound: the sound you want to write out to a file
path: the path to the file you want the picture written to
Takes a sound and a filename (a string) and writes the sound to that file as a WAV file. (Make sure that the filename ends in '.wav' if you want the operating system to treat it right.)
Example:
def writeTempSound(sound):
  writeSoundTo(sound, 'C:\\temp\\temp.wav')
This takes in a sound and writes it out to a file called temp.wav in C:\temp\. _