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.
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.
- 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.
- 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.
- 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.
- What is your understanding of what an object is (e.g. a gr.Rectangle, gr.Point, or gr.Circle)?
- If the variable box holds a gr.Rectangle object, how do you set its fill color?
- What parameters does object.draw(...) take? Why would a computer need that parameter?
- Which artwork/artist did you choose as inspiration? Why?
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.
- Create a 2nd (or 3rd) scene.
- Use computational thinking to create complexity in your scene with efficient code. Be sure to point out how you did this in your report.
- Design more complex objects.
- Use multiple command line arguments to control several aspects of the scene.
- Use methods from the Zelle library not described in the lab. For example, you can add text and images to a scene.
- Use the Polygon class to create more complicated shapes (than n-gons).
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.
- Is your name at the top of each code file?
- 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.
A brief summary of the project, in your own words. This should be no more than a few sentences. Give the reader context and identify the key purpose of the assignment. Each assignment will have both a core CS purpose--such as using loops and conditionals--and an application such as making images in the style of an artist.
Writing an effective abstract is an important skill. Consider the following questions while writing it.
- Does it describe the CS concepts of the project (e.g. writing well-organized and efficient code)?
- Does it describe the specific project application (e.g. making images)?
- Does it describe your the solution or how it was developed (e.g. what code did you write)?
- Does it describe the results or outputs (e.g. did your code work as expected)?
- Is it concise?
- Are all of the terms well-defined?
- Does it read logically and in the proper order?
For each task, If you completed the task, include an image of the completed task and write a few sentences describing the image/what you did. This should be a description of the form and functionality of your final code. Note any unique computational solutions you developed or any insights you gained from your code's output.
If you didn't complete the task insert an image showing how far you got. Write a few sentences describing how much you completed, where you got stuck and what what solutions you tried.
You may want to incorporate code snippets in your description to point out relevant features. Code snippets should be small segments of code--usually less than a whole function--that demonstrate a particular concept. If you find yourself including more than 5-10 lines of code, it's probably not a snippet.
A description of any extensions you undertook, including text output or images demonstrating those extensions. If you added any modules, functions, or other design components, note their structure and the algorithms you used.
- Follow-up Questions
The answers to any follow-up questions (there will be 3-4 for each project).
A brief description (1-3 sentences) of what you learned. Think about the answer to this question in terms of the stated purpose of the project. What are some specific things you had to learn or discover in order to complete the project?
A list of people you worked with, including TAs and professors. Include in that list anyone whose code you may have seen, such as those of friends who have taken the course in a previous semester.
A list of any resources that you used. This includes textbooks, lecture notes, python documentation, library documentation or forums. If you used a specific website, please link to it.
- Put the label cs151s20project4 on your wiki page.