import turtle def curvemove(): for i in range(200): turtle.right(1) turtle.forward(1) turtle.color('red','pink') turtle.begin_fill() turtle.left(140) turtle.forward(150.65) curvemove() turtle.left(140) curvemove() turtle.forward(150.65) turtle.end_fill() turtle.done()
(1) brush movement command:
command | Explanation |
---|---|
turtle.forward(distance) | Pixel distance moved lengthwise direction of the current pen |
turtle.backward(distance) | Pixel distance moved in the opposite direction to the current length of the brush |
turtle.right(degree) | Moving clockwise degree ° |
turtle.left(degree) | Moves counterclockwise degree ° |
turtle.pendown() | Graphics rendering, the default is also moved to draw |
turtle.goto(x,y) | The pen is moved to the coordinate x, y position |
turtle.penup() | Not draw graphics, Gv is moved, for use when a drawn from other places |
turtle.speed(speed) | Brushed speed range [0,10] Integer |
turtle.circle() | Circle, the radius is positive (negative), represents the center (on the right) to draw a circle on the left side of the brush |
(2) Brush control command:
command | Explanation |
---|---|
turtle.pensize(width) | When the width of the drawing pattern |
turtle.pencolor () | Brush Color |
turtle.fillcolor(colorstring) | Draw fill color graphics |
turtle.color(color1, color2) | And set pencolor = color1, fillcolor = color2 |
turtle.filling() | Returns whether the current state of the filling |
turtle.begin_fill() | Ready to start filling graphics |
turtle.end_fill() | The filling is completed; |
turtle.hideturtle() | Hide arrows show; |
turtle.showturtle() | And hideturtle () function corresponding to |
(3) a global control command
command | Explanation |
---|---|
turtle.clear() | Empty turtle window, but the turtle's location and status will not change |
turtle.reset() | Clear window, reset state as a starting state turtle |
turtle.undo() | Undo the last turtle action |
turtle.isvisible() | Returns the current turtle is visible |
stamp() | Copy the current graphics |