turtle study notes

A, turtle form layout drawing (using the minimum unit is a pixel in the window)

 

 

With turtle.setup (width, height, startx, starty) function sets the startup form position and size parameters not write, the default window in the middle of the screen. Turtle.setup () is not necessary, only in writing when the program needs to control the size of the form, only need to use this function.

 

Brush Control Function two turtle

1 turtle.penup () picked his brushes, not to draw graphics

   turtle.pendown () brush down, he began to draw graphics     appear generally penup paired with pendown 

2 turtle.pensize (width) to set the width of the brush

3 turtle.pencolor (color) color pen set       where parameter may be a string or rgb color value, color table as common rgb 

 

4, filled function

Fill color setting: turtle.fillcolor (color)

Begins to fill: turtle.begin_fill ()

End filling: turtle.end_fill ()

5, turtle.hideturtle () hides the shape of the brush turtle

      turtle.showturtle () show the shape of the brush turtle

6 turtle.speed (speed) setting the moving speed of the brush speed range [0,10] integer, the larger the number, the faster

 

Three, turtle motion control function

turtle.forward (distance) in the forward direction before the brush, alias turtle.fd (d), d may be negative in this case, retrogression
turtle.circle (r, extent) plotted according to the curvature radius r extent
 
Four, turtle direction control function: only change the direction of travel of sea turtles
 turtle.seth (angle) to set the current angle towards an angle
turtle.right (angle) Rotate Right turtles
turtle.left (angle) Rotate left returnees
turtle.goto (x, y) coordinates of the pen is moved to (x, y) position
 

 

Guess you like

Origin www.cnblogs.com/qinlai/p/12465682.html