Home  >  Article  >  Backend Development  >  Draw simple animals with python

Draw simple animals with python

silencement
silencementOriginal
2019-06-05 09:23:3714969browse

Draw simple animals with python

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 nameFunctionturtle.pensize()Set the brush sizeturtle.hideturtle()Hide brusht.speed()Set the speed of the brush, parameter range is 0~10##t .penup()t.pendown()t.seth()t.begin_fill()t.end_fill()t.fd()t.bd()t.pencolor()t.fillcolor()t .circle()
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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn