Python draws a five-pointed star and fills it with color. Python draws a five-pointed star and requires it to be centered.

Hello everyone, the editor is here to answer the following questions for you. How to draw a five-pointed star in python and fill it with different colors. Illustrated steps of how to draw a five-pointed star in python. Now let's take a look!

1. import turtle imports the drawing function library

2. turtle.pensize() adjusts the brush pixels

3. turtle.pencolor() adjusts the brush color

4. turtle.write() input text 5

5. turtle.forward() controls the brush forward

6. turtle.right/left() controls the direction of the brush

7. Two methods of drawing a five-pointed star

     (1) Directly control the brush with code

        (2) Use for loop to implement drawing

Guess you like

Origin blog.csdn.net/mynote/article/details/135200828