The final project of the semester is to put together a simple interactive drawing program that enables a user to draw scenes using different artistic styles and graphical objects.
You may work in pairs for this project. If you choose to do so, only create one writeup. In the writeup you will need to indicate the contribution of each person to the work. If you work in a pair, the expectations will be somewhat higher than if you work alone.
To build an interactive program you need two things. First, you have to set up the user interface, creating all of the components and placing them appropriately. Second, you need a main loop that waits for user interaction and reacts appropriately.
How complex you make your program is up to you. The required capabilities are the following:
- The user should be able to select a drawing style from at least two choices.
- The user should be able to select the current color attribute. Any objects created should use the currently selected parameters (trees may be an exception to the rule, if you wish). You can use a limited palette of colors, or let the user enter arbitrary RGB values. The basic requirement is that the color applies only to the outline of the object (fill not required).
- The user should be able to select a graphical object to create. The list of options should include at least: a line, a rectangle, a circle, and an L-system. The program then needs to instruct the user how to use the mouse to place the object on the screen.
- The user should be able to delete the last object created, and do this repeatedly all the way back to the first object drawn. Giving the user the ability to redo is not necessary.
- Extend the program in some way beyond the basic requirements above.
The following are some suggestions for handling various aspects of the project.
- You are free to continue to use the AggregateBase class as the parent class for complex graphical objects, including crayon and brush lines.
- Design the GUI on paper before trying to create it in code. Keep your first attempt very simple. When you do start to code, just put the GUI skeleton in place and don't have it actually do anything when you click except print out what it would try to do. Have some text at the bottom of the screen say what the GUI wants the user to do.
- In lab, we'll create some simple menu classes for fixed and popup menus. They will form the basis for most of your GUI interaction.
- As you build the program, test at each step along the way. Don't try to implement all of the capabilities or objects at once. Start with black line segments of width 1, for example, then add black rectangles, then add the capability to set the color, and so on.
- Think about how you could use of dictionaries and the fact that you can assign a function reference to a variable. You can, for example, assign a function reference to a dictionary entry for a particular menu item. If your menu class returns a string corresponding to the user's selection, you can use that string to index into a dictionary and get the proper function to execute.
- Make use of the fact that you can dynamically add fields to any object. For example, the window object you create using GraphWin can be given additional fields to hold the currently selected color, the list of shapes, and the help text object. We'll go over an example of this in class.
The following are suggested extensions.
- Implement more than two artistic styles.
- Implement more graphical objects like images or the Peace sign.
- Provide more drawing attributes, like line width and fill color.
- Implement the ability to select objects.
- Implement your interface and graphical objects so they can be rotated/oriented.
Create a web page for your writeup. Your writeup should include the following.
- A brief description of the task (in your own words).
- Provide a brief manual for your program, including how to run it and use it.
- Explain your main interaction loop.
- Create an interesting scene using your program.
- Have a friend who is not in the class create a scene using your program. Include the image in your writeup (with their permission).
- Briefly describe your friend's experience with your program.
- A description of and pictures for any extensions you did.
- If you worked with a partner, indicate what each person did as part of the project.
- One final thing: go through all of your labs and pick out some pictures (at least 2, but not more than 10) that you really like and put them together on a separate portfolio page with a short caption along with each. Be sure to include which lab the picture came from and some details about how it was created. (If you feel like it, make some new pictures with the old code, but don't go overboard.)
When your writeup is ready for viewing and linked to your index page, send me an email.
To hand in your python code, place it on the Academics fileserver in the private folder. Do not post it on the web. You may include snippets from your code in your writeup to demonstrate how certain aspects of the function work, but please do not include the whole thing.
To place the code on the fileserver, go to the server fileserver1 and select the Academics volume. Within that there ought to be a CS151 folder, and within that there should be a folder with your username, and within that ought to be a folder labeled private. You can read and write files to the private directory and I can read them, but no one else can access them. Put your python files in that directory to hand them in. Please organize your files into folders by project.