CS 115 Homework 7 Graphics (Individual)
40 Points
Due Date: Sunday, March 28 midnight (Extended from normal schedule)
Submit with Canvas submit link.
Educational goals of this lab - verify that every student can use the concepts
- write some graphics code in Python
- learn a little about object oriented programming and the dot notation
Preparations:
watch videos on
INSTRUCTIONS:
(40 points) Individual Problem: Trying some graphics
- Write a program that draws a greeting card customized with a
person's name. You can choose the purpose of the card
(get well, sympathy, birthday, holiday, etc.)
You decide what drawing goes on the card.
- Your program must:
- (6 points) Ask the user for the name of the person the card is for. Use the Entry method.
There are 5 steps to using this method to do input:
- Create a Text object with your prompt like "Enter the receiver's name " and draw it
- Create an Entry object
- Draw the Entry object
- Use the getMouse() method of the GraphWin object to allow the user time to type
- Use the getText() method of the Entry object to get the user's input
After the name has been input, Undraw the entry box and prompt! you don't want them cluttering up your card! objectname.undraw() - no arguments, it knows which window it was drawn on.
- (6 points) Display the person's name on the graphics window somewhere using a Text object.
- (6 points) Your Python program must use objects of least 6 different classes
(Points, Lines, Circles, Rectangles, etc.).
- (5 points) The program must use at least five colors (besides black and white!).
- (6 points) It must have a prolog (header) comment. Your name, section, email, 3 P's.
- (5 points) And put some other documentation in the program too! Mark off the different sections of code
with comments about what they draw.
Here is an example (not a great one!).
Of course, do not duplicate this one! Use your creativity here!
- (6 points) Make SURE that you end your program with some
code that will make the user "Click to close window",
This habit will save you LOTS of headaches later!
Use a Text object to show a message "click to close window" and a getMouse
method to pause the program.
- Don't forget to close the window!
- Submit your finished
program with the Canvas link.