CS 107: Pictures and Sounds: Programming with Multimedia

Kalamazoo College

Winter 2009

Mini-Lab: Getting Started with JES

 


Introduction

The objective of this mini-lab is to become familiar with the programming environment JES (Jython Environment for Students) which will be used in COMP107.



Becoming familiar with JES

  1. Start JES (Start -> All Programs -> JES). It may take a little while to start.
     
  2. To start becoming familiar with the JES graphical user interface, type some simple Python commands into the command area. (This is the bottom half of the JES window.) If you have your textbook, try typing in the various examples on pages 19 - 21. Otherwise, try a few simple commands like:
    print 3 + 4
    print "Hello" + "World"
  3. Click on the Help menu, and browse through Sections 2 (Getting started with JES) and 3 (Programming in Jython).

Working with picture files

Some of the following exercises will have questions to be answered and turned in at the end of the mini-lab.
  1. In the JES command area, type the following command (make sure upper/lower cases are exactly as given here):
    myFile = pickAFile()
    A file selector will open. Choose a file from the \My Documents\My Pictures\Sample Pictures folder. (If you have the energy to do a lot of clicking, you can find a wider selection of images in \My Network Places\Entire Network\Microsoft Windows Network\Knet\Dragon\cls_compsci\cs107\MediaSources\)
     
  2. Highlight the text pickAFile (without the parenthesis), then go to the JES Help and click on Explain. What is this function pickAFile() doing? Write down your answer in a complete sentence on a new sheet of paper.
     
  3. Type the command print myFile into the command area. What is printed? Using sentences, write down the result and explain what this command is doing.
     
  4. Now type in the command myPict = makePicture(myFile). Again, highlight makePicture, go to JES Help, and then to Explain. Write down what this function is doing.
     
  5. Type the command print myPict. What is printed? Write down your result.
     
  6. Type the command show(myPict). A new window should appear with your picture displayed.
     
  7. Go to the JES menu item MediaTools, select Picture Tool..., and choose the picture myPict. After clicking OK, another window will pop open which shows the picture.
     
  8. Experiment with the features provided by the picture tool: change the zoom level and look at the color values at different points of the picture by clicking on those points. (Note that color values may not display correctly unless the picture is zoomed at 100%.) Write down which image file you used, and the highest and lowest values you find for red, green, and blue.
     

Working with sound files

Complete the following exercises if you have time.
  1. Use the pickAFile function to select a sound file from the MediaSources directory:
    soundFile = pickAFile()
    The sound files have a .wav extension.
     
  2. Now type in the command sound = makeSound(soundFile).
     
  3. Try playing the sound using the play function: play(sound). If nothing happens, make sure that the volume isn't turned all the way down on your computer.
     
  4. Turn in your answers to the questions in these exercises.