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

Excersise Set 1

I have placed the Templates here as well to help you with the excersises below.

Here are some pictures I used in class. You can right click on them with your mouse to save them on your computer. I suggest you use them as starters, but then try using your own. Remember, these are .jpg images.
color_strip (1px x 6px)color_lines (10px x 6px) color_stripes(100px x 120px)color_flag(180px x 120px)
External ImageExternal Image External ImageExternal Image


Here are some problems to try on your own. Don't look at my answers until you have tried your own solution at least twice.

1) Write a function named midGreen that has a picture’s name hardcoded as the variable file; shows the picture in the show box; changes the entire green channel of the picture to equal 128; and repaints the picture. Answer 3.1

2) Write a function named noRed that has the user enter a picture’s name on function call; shows the picture in the show box; changes the entire red channel of the picture to equal 0; and repaints the picture. Answer 3.2

3) Write a function named allBlue that loads a picture from pickAFile ; shows the picture in the picture tool; changes the entire blue channel of the picture to equal 255; and repaints the picture. Answer 3.3

4) Write a function named halfGreen that loads a picture from pickAFile ; shows the picture in the picture tool; changes each pixels green value to half of what it was and repaints the picture. Answer 3.4

5) Write a function named quarterRed that has a picture’s name hardcoded as the variable file; shows the picture in the show box; changes each pixels red value to a quarter of what it was; and repaints the picture. Answer 3.5

6) Write a function named redBlue that has the user enter a picture’s name on function call; shows the picture in the show box; changes the red value of each pixel to equal its blue value; and repaints the picture. Answer 3.6

7) Write a function named blueHalfGreen that has the user enter a picture’s name on function call; shows the picture in the show box; changes the blue value of each pixel to equal half its Green value; and repaints the picture. Answer 3.7

8) Write a function named makeNegative that loads a picture from pickAFile ; shows the picture in the picture tool; changes the color of each pixel to its negative; and repaints the picture. Answer 3.8

9) Write a function named makeBandW that loads a picture from pickAFile ; shows the picture in the picture tool; changes the color picture to black and white; and repaints the picture. Answer 3.9

10) Try making up some functions of your own.

Link to this Page