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

CS4452 Final Exam Materials

Final Exam Document

Final Exam.doc (MS Word format)


Hints for Problemmatic Question 4, Part IV

Andrew has pointed out a problem in Question 4, Part IV and how it interacts with Part III of the same problem. In order to minimize everyone's grief in solving this problem (sorry!!), I want to offer three suggestions, any of which would be acceptable for solving this problem.

Suggestion 1: Submit a class instead of a function.
Andrew's right; all of the examples we've seen on GUIs show event handling with classes. Classes offer a lot of convenience for callbacks, particularly because if you're calling back into a class method, then the class method has access to the instance variables of the class. If you make a callback point to a typical function, you're much more limited.

You're welcome to submit a class named InteractiveSlideShow, which subclasses ArtisticSlideShowFrame and has a constructor that takes the directory and a Sound object instead of submitting an interactiveSlideShow() function. This approach allows you to re-define prev(), next(), and, optionally, setArtistic() as needed and makes the GUI code look a little more like the GUI code presented in class.

Suggestion 2: Have your interactiveSlideShow() function built using two classes that work together – your ArtisticSlideShow class and a class that implements the GUI.
The GUI class would probably have an instance variable that contains a reference to the ArtisticSlideShow instance so that once events started coming in to the GUI class, the GUI class could immediately invoke the right methods on the ArtisticSlideShow instance. This is a little more complicated, since you have to start thinking about how classes work together, but also a perfectly acceptable solution.

Suggestion 3: Modify your implementation of the ArtisticSlideShow class from Part III so that it contains callback-friendly methods and/or needed GUI code for the interactiveSlideShow() function.
This is the least desirable solution, since classes are meant to exhibit modularity, and a well-designed class (which would be the result of a well-designed exam question) would not contain any code beyond that which is absolutely necessary to get its own job done. However, given that I overlooked this detail, it's absolutely okay for your ArtisticSlideShow's next() and prev() methods to both take event parameters (e.g., def next(self, event):). You could also add a method to the class that generates and displays the interactiveSlideShow GUI – but please don't put this in the constructor, as we want to be able to evaluate parts III and IV separately! Note that if you go with this option, the sample code using the ArtisticSlideShow class from Part III would read:

win2 = ArtisticSlideShowFrame(r'C:\Temp\SlideShowPics') # Displays first of several
# JPGs in the specified
# directory normally
win2.next(None) # Displays second JPG normally
win2.setArtistic(1) # Displays second JPG with your artistic effect
win2.prev(None) # Displays first JPG again, now with your artistic effect
print win2.isArtistic() # Should be 1 since we're currently in "artistic mode"
win2.setArtistic(0) # Displays first JPG normally
win2.prev(None) # Continues showing first JPG normally (no error)
print win2.isArtistic() # Should be 0 since we're currently in "normal mode"
print win2.isDone # Should be 0 since the first JPG is being displayed

(the difference being the Nones being passed to prev() and next() throughout the examples)

If you implement any of these three suggestions, your solution will be evaluated as correct.

Apologies for the conflicting directions in Question 4 – Beth and I will be sure to be extra-gracious when we're looking at your solutions to the parts of the problem in question. Special thanks to Andrew for pointing out the discrepancy!

Steve Voida



Materials for question #1

Sample student information file

1315students.txt (drop this in your JES directory to test your functions)

Note: If you use this file for testing and attempt the example function calls listed in the exam, all examples will return the same values as listed in the exam except for the last example – the one for the findgtgs() function.

Here is a revised example of the output your findgtgs() function should produce when using the full sample student information file:
>>> findgtgs(["Knightley", "Jon Stewart", "P"])
Keira Knightley: gtg563b
Student not found.
George P. Burdell: gtg123a
Brad Pitt: gte444q
Sarah Jessica Parker: gtg886f
Natalie Portman: gtg182v
Peter Jackson: gtg796p
Payton Manning: gtg455k



Materials for question #2

Picture-manipulation helper functions

q2.py (use this as a starting point for your submission)


Sample source pictures you can use to test your infinitePicture() function:

Uploaded Image: pictureframe.gif
The original man-with-frame picture

Uploaded Image: sierpinski.gif
The original Sierpinski triangle picture


Results of the infinitePicture() function on each of the sample source pictures:

Uploaded Image: pictureframe-infinite.jpg
result = infinitePicture(makePicture('pictureframe.gif'))

Uploaded Image: sierpinski-infinite.jpg
result2 = infinitePicture(makePicture('sierpinski.gif'))


Materials for question #4


The original ImageFrame class implementation:

q4.py (use this as a starting point for your submission)

Link to this Page