Directory for Python files: in jlmullan/Project 2
The purpose of this task was to use python and turtle to create various shapes, which I then used to make some outdoor scenes. The color and width functions helped to transform the shapes into a more interesting picture. In scene 1, I developed a code for a house with a scale factor that allowed me to make multiple houses of different size just by changing one number.
Code for house:
I also used the function "pencolor" to make the outline of the house brown and a width of 4. To make a seesaw in the scene, I made two isosceles triangles of the same size and placed a parallelogram on top of it. The lamp was the most complicated figure in this scene. I started it by first drawing a thin, tall rectangle for the base. Then I created a loop function for the lamp to make the light appear as a starburst. The outline of the light I made orange, and I used the fill function to fill it yellow.
Code for light portion of lamp:
for i in range (60):
For the second scene I began by making a blue line of width 10 for the “road” and then a trapezoid for the body of a car. For the wheels of the car I used a decagon function. The speed limit sign was made next. I made the code for the body of the sign before I created the code for the numbers on it, since this order made it easier to scale the numbers and come up with their x,y positions. Lastly, I came up with one function for a star with a scale factor and used a fill color of yellow. The random function was imported to draw 20 differently sized stars at different locations in the sky.
Code for star:
for i in range(5):
Code for random stars:
for i in range(20):
The extensions I chose to undergo included using the random function to generate 20 random stars and using the color, width, and fill functions in my two scenes.
This project helped me become much more familiar with making pictures using turtle. I learned how to move shapes around on screen to create images, how to use random to make a scene more interesting, and how to use the fill and color functions. I also learned how to use scale factors to make many different sizes of an image. One very useful thing I learned was turtle.seth(0), which I used to reset the cursor in between images. Overall I am now much more proficient at using turtle than I was before this project.