Turtle learning

First, understand the Turtle

       (1) Turtle library is a library Python language in a very popular draw images

       (2) Turtle library for drawing lines, circles, text, or other shapes

 

Second, the commonly used commands

    (1) turtle.setup (width, height , statx = None, starty = None)
size and location setting operation window displayed on the main screen command
width - if it is an integer, the size in pixels, if a float, then as part of the screen; the default is 50% of the screen
height - if an integer, height in pixels, if a floating point number, was part of the screen; the default is 75% of the screen
startx - if positive, from the left edge of the screen start (in pixels), is negative if the right edge, if None, the window is centered horizontally
starty - if positive, starts from the edge of the screen (in pixels), if it is negative from the lower edge, if none, the vertically centered window
    (2) turtle.pensize () set brush width
    (3) turtle.pencolor () set brush color
    (4) turtle.speed (speed = none ) passing speed brush speed parameter set to [0, 10] an integer of 1 to 10. the higher the number the faster the rate, speed = 0 fastest
    (5) turtle.forward (distance) moving distance to the current pixel length direction of the brush
    (6) turtle.backward (distance) to the opposite side of the current pen The mobile pixel length distance
    movement (7) turtle.right (degree) [deg.] Clockwise Degree
    (. 8) turtle.left (Degree) [deg.] Counterclockwise movement Degree
    (. 9) turtle.circle (RADIUS, extents = None, Steps = None)
radius (radius) - radius of positive (negative) represents the center of the brush to the left (right) circle;
extents (rad) (optional);
Steps (optional) - do circle with a radius of an inscribed radius of the regular polygon, the polygon number of sides Steps
    (10) turtle.fillcolor (colorstring) drawing the fill color pattern
    (11) turtle.hideturtle () hides the shape of the brush turtle

 

Third, actual project

       

 

Fourth, operating results

        

 

Guess you like

Origin www.cnblogs.com/wt714/p/11520376.html