Presentation is loading. Please wait.

Presentation is loading. Please wait.

Download JES Tool JES: Jython Environment for Students

Similar presentations


Presentation on theme: "Download JES Tool JES: Jython Environment for Students"— Presentation transcript:

1 Download JES Tool JES: Jython Environment for Students
Python development tool developed by Georgia Tech Download and install JES at C:/100 From Select jes windows-java-included.zip And select “Save As” to download to C:/100

2 Download JES Tool Right-click on the zip file, select 7-zip, and select ‘Extract Here.’

3 Download media files Under C:\100, you should have C:\100\JES.exe
Create a new folder pics under C:\100 Download Save into C:\100\pics Right click and select 7-zip &‘Extract here.” Under C:\100, you should have C:\100\JES.exe C:\100\pics (folder)

4 Python/JES JES IDE (Integrated Development Environment)
Incorporates editing environment Program pane Command pane Watcher button to view debugging

5 Picture Functions in JES
pickAFile() opens a file browser to select a file makePicture(filename) creates and returns a picture object, from the JPEG file at the filename show(pic) displays a picture in a window repaint(picture) to re-display after changing it FileImage() pic.draw()

6 How to access a Picture in JES ?
Select a picture file For example, myFile = pickAFile() WARNING: picture file (eiffel.jpg) is NOT a picture A picture file HAS TO BE converted to a picture object myPic = makePicture(myFile) Or, myPic = makePicture(pickAFile())

7 Other Pixel Functions getPixel(pic,x,y) to get a single pixel pic.getPixelt(x,y) getRed, getGreen, and getBlue are functions that return a color value (between 0 and 255) at a specified pixel setRed, setGreen, and setBlue are functions that set its color value at a specified pixel We can also get, set, and make colors getColor returns a Color object with three color values at a pixel setColor sets the pixel to the specified color makeColor returns a Color object with specified three color values pickAColor lets you use a color chooser and returns the chosen color

8 Example >>> thisPixel = getPixel(myPic,1,1)
>>> print thisPixel Pixel, color=color r=168 g=131 b=105 # get/set individual color values >>> print getRed(thisPixel) 168 >>> setRed(thisPixel,255) 255 >>> color=getColor(thisPixel) >>> print color color r=255 g=131 b=105 >>> setColor(thisPixel,color)

9 Example >>> newColor=makeColor(0,100,0)
>>> print newColor color r=0 g=100 b=0 >>> setColor(thisPixel,newColor) >>> print getColor(thisPixel) >>> print color color r=168 g=131 b=105 >>> print makeDarker(color) color r=117 g=91 b=73 >>> newcolor=pickAColor() >>> print newcolor color r=255 g=51 b=51

10 Change Colors Directly
>>> file=pickAFile() >>> pict=makePicture(file) >>> show(pict) >>> setColor(getPixel(pict,10,100),black) >>> setColor(getPixel(pict,11,100),black) >>> setColor(getPixel(pict,12,100),black) >>> setColor(getPixel(pict,13,100),black) >>> repaint(pict)

11 LAB Draw a horizontal line of 100 pixel from (20,50) in a picture
Write a Python function hLine(pic, len) to draw a horizontal line of length ‘len’ from (20,50) of a picture ‘pic.’ Write a Python function diag(pic, len, tx,ty) to draw a diagonal line of length ‘len’ starting at location (tx,ty)


Download ppt "Download JES Tool JES: Jython Environment for Students"

Similar presentations


Ads by Google