This lab assignment requires you to write programs using objects from the Zelle graphics library.
The goals for this lab assignment are:
For this problem we want you to write a function (drawShape) and then
use that function to generate a pattern like this:
First, in a file called pattern.py, write a function called
drawShape(win,pt,size) that draws some shape (something more than just
a circle or a rectangle) in the given window (win),
at the given point (pt), of the given size (size). You may create
your own custom shape, if you want, or have your function make one of these:
Test your function by calling it from main(). For example, here's a main() that calls drawShape() twice, using different points and sizes:
def main(): width = 600 height = width gw = GraphWin("pattern", width, height) pt = Point(200,200) drawShape(gw,pt,30) pt.move(200,20) drawShape(gw,pt,100)
Once you are certain your function works, ask the user for the number of rows, and use your drawShape() function to draw the pattern (1 shape on row 1, 2 on row 2, etc). Asking for the number of rows and calling drawShape() to draw the pattern should all be done from main().
Here's another image from the running program. For this run, the user
asked for 18 rows. Notice that the window is the same size, but the shapes are
all smaller than when there were only 5 rows.
Hints: If you are stuck on how to display the pattern of shapes, concentrate
on drawing just one row. For example, how would you use a for loop in main()
to call drawShape() over and over, to draw 5 shapes horizontally, like this?
Once you have that working, how can you repeat that for multiple rows?
I've been watching the Travelers show on Netflix, and they have a cool text effect during the show's opening credits. It looks something like this:
Write a program, travelers.py, that asks the user for a word, and then displays the "travelers" effect for that word. In the above video, the user entered the word "hello". For the video below, the user entered "travelers":
Hints:
In the above videos, the final word is displayed all at once. For fun (and more like the show's credits), have the final letters appear one-by-one, over time, ending in all letters being displayed.
Write a program called beach.py that generates a summer scene, using mouse-clicks from the user. Here's an example:
Here are the requirements and some tips for this program:
Add more stuff to your beach scene or animation! Let the user decide the size of the sun, or make the colors change as the sun sets.
Once you are confident that all programs work, fill out the questionnaire in README-05.txt.
Then run handin21 a final time to make sure we have access to the most recent versions of the files required for this lab.