74.9k views
5 votes
100 POINTS

PYTHON PROGRAMMING I:

TURTLE GRAPHICS PROJECT


For this project you are going to create a program that draws at least 5 flowers. Each flower must have at least 5 flower petals, and can be of any shape, size or color, but each flower petal must be distinguishable from the other. See fig. 1 below. Only one of the flowers may be centered on the canvas. The rest of the flowers can be placed visibly anywhere on the canvas. See fig. 2 Each flower must use a different shape and color scheme.

100 POINTS PYTHON PROGRAMMING I: TURTLE GRAPHICS PROJECT For this project you are-example-1

1 Answer

3 votes

For this project, you will need to use the Turtle Graphics library in Python. This library allows you to draw shapes and objects on the screen using commands.

To start, you will need to import the Turtle library. You can do this by typing the following code into your Python program:

import turtle

Next, you will need to create a turtle object. This will be the object that you will use to draw your flowers. You can do this by typing the following code into your program:

flower_turtle = turtle.Turtle()

Now that you have your turtle object, you can start drawing your flowers. To draw a flower, you will need to use the turtle's methods to draw the petals. For example, you can use the turtle's forward() method to draw a line, and the turtle's left() or right() methods to turn the turtle.

To draw a flower with 5 petals, you can use a for loop to repeat the drawing of the petals. For example, you can use the following code to draw a flower with 5 petals:

for i in range(5):
flower_turtle.forward(50)
flower_turtle.left(72)

You can also use the turtle's color() method to change the color of the petals. For example, you can use the following code to draw a flower with 5 red petals:

for i in range(5):
flower_turtle.color("red")
flower_turtle.forward(50)
flower_turtle.left(72)

Once you have drawn your first flower, you can repeat the process to draw more flowers. You can also use the turtle's penup() and pendown() methods to move the turtle without drawing a line.

Once you have finished drawing your flowers, you can use the turtle's done() method to close the window.

Good luck with your project!
User Oleg Sevruk
by
7.6k points