Use python to draw simple pictures, which are drawn using the turtle library. Turtle is translated into Chinese as turtle. Turtle controls pixel coordinates through various functions to move forward, backward, change directions, etc. Operation, set the brush color and fill color through functions to outline and fill in colors.
The main function of turtle module
Function | |
---|---|
Set the brush size | |
Hide brush | |
Set the speed of the brush, parameter range is 0~10 | |
Start writing, there will be no pictures when moving | |
Putting down the pen, there will be pictures when moving | |
Set the direction of the brush to a certain degree, 0-east; 90-north; 180-west; 270-south | |
Start drawing | |
End drawing | |
Move the specified distance towards the direction of the brush, the parameter is the distance | |
Move the specified distance in the opposite direction of the brush, the parameter is the distance | |
Set the color of the brush, the parameter is RGB format or Color name | |
Set the fill color, the parameter is RGB format or color name | |
Set a circle with a specified radius, and the parameter is the radius. |
The above is the detailed content of Draw simple animals with python. For more information, please follow other related articles on the PHP Chinese website!