CS 151: Project 4

Title image Project 4
Spring 2020

Project 4: Realistic Scene

The purpose of this project is to give you experience with both lists and graphics objects. The end result should be

Here is the reference guide to the Zelle graphics package.


Tasks

You'll create a scene that is a collection of complex objects inspired by an artist or artwork from the Social Realism Art Movement. It can be inspired by the content or color palette of a painting. The complex objects will all be collections of Zelle graphics primitives and have the same organization as the spaceship you created in lab. Each complex object will have a function that initializes it and any complex object that changes will have a function that animates it.

Make sure you have the graphicsPlus.py file in your working directory.

  1. Develop a design for a scene

    Think about a scene you want to create inspired by an artist or artwork from the Social Realism Art Movement. Design the scene on paper as a collection of complex objects like people, buildings, trees, or ships. Come up with at least 3 complex objects of your own that you want to create for your scene.

    Include a photo of your design document as part of your report.

  2. Design your 3 complex objects

    Create a file for your project (e.g. complex_shapes.py). You can choose whether to put everything into one file or to have a separate file for each complex object. There are pros and cons for either choice. The overall scene should be defined in a separate file (e.g. realism.py).

    For each of the complex objects, create a new init function. For example, we created rocket_init to make the spaceship and return its shapes list. Follow the same convention for your other complex objects. For a stoplight, for example, create stoplight_init.

    Each init function should always have the parameters x, y, and scale, which you should use just as in project 3 so that the object can be placed anywhere at any scale. The init function should return a list of the primitive objects that make up the complex object, just like we did with the rocket_init function.

    For each complex object you create, make a test function. For example, we created the main function in rocket.py. The test function should create a window, create multiple versions of the complex object at different sizes and locations, and then wait for a mouse click to quit.

    If you didn't already create a utility function draw( shapes, win ) to handle drawing the objects in a shapes list into the window, it will save you code to do so now.

    Include a picture for each complex object in your report (3 pictures total for this task). For each complex object, show it in three different positions and sizes.

  3. Design your scene

    Make a file realism.py and import your complex_shape package, and the graphics package. This file should have at least a main function (you can create other functions as you see fit to organize the code).

    The main function should initialize the complex objects in the scene and draw them into the window to create a scene. Look for inspiration in the Social Realism Art Movement.

    As with project 3, make some aspect of your scene depend on a command line argument. Be sure to explain this in your report.

    Include two pictures of your scene in your report. The differences in the two scenes should demonstrate how the command line argument affects the scene.


Follow-up Questions

  1. What is your understanding of what an object is (e.g. a gr.Rectangle, gr.Point, or gr.Circle)?
  2. If the variable box holds a gr.Rectangle object, how do you set its fill color?
  3. What parameters does object.draw(...) take? Why would a computer need that parameter?
  4. Which artwork/artist did you choose as inspiration? Why?

Extensions

Extensions are your opportunity to customize your project, learn something else of interest to you, and improve your grade. The following are some suggested extensions, but you are free to choose your own. Be sure to describe any extensions you complete in your report. Include pictures.


Submit your code

Turn in your code (all files ending with .py) by putting it the appropriate directory in the Courses server. On the Courses server, you should have access to a directory called CS151, and within that, a directory with your user name. Within this directory is a directory named Private. Within that is a directory for each week's project, where you should submit your code. Please submit only code that you want to be graded.

When submitting your code, double check the following.

  1. Is your name at the top of each code file?
  2. Does every function have a comment or docstring specifying what it does?


Write Your Project Report

If you haven't already made a new page for this report on the wiki, then make one now (Log into the wiki, goto your Personal space by selecting "Personal Space" on the menu under the Person icon, then make the page using the "Create" button. Please use the CS 151 template. Put the label cs151s20project4 in the label field on the bottom of the page. But give the page a meaningful title.

Your intended audience for your report is your peers not in the class. From week to week you can assume your audience has read your prior reports. Your goal should be to be able to use it to explain to friends what you accomplished in this project and to give them a sense of how you did it.

Your project report should contain the following elements. Please include a header for each section.