Getting Started with Python (an interesting example of the actual drawing) you certainly will not

 

Introduction
text and pictures of this article from the network, only to learn, exchange, not for any commercial purposes, belongs to original author, if any questions, please contact us for treatment.
Author: qiu_fang 

Draw a cute python (python):

the introduction of import turtle # library functions turtle (drawing little turtle)

drawSnake DEF (RAD, angle, len, neckrad):
    for i in the Range (len):
        turtle.circle (RAD, angle) # draw an arc radius rad (as is the right starting point, the starting point is negative in the left) , central angle corresponding to angle
        turtle.circle (-Rad, angle)
    turtle.circle (RAD, angle / 2)
    turtle.fd (RAD) # painting line, length: RAD
    turtle.circle (neckrad + 1,180)
    turtle.fd (RAD 2 * /. 3)


DEF main ():
    turtle.setup (1300,1300,0,0) size # 1300 * 1300, the top left coordinate is initialized to draw the interface (0,0)
    pythonsize = 30
    turtle.pensize (pythonsize) # brush size 30
    turtle.pencolor ( 'Purple') # pen color
    turtle.seth (-40) # brush turtle initial direction
    drawSnake (40,80,3, pythonsize / 2) # call function starts drawing


main()

After running you can see the painting process of the cute python! If you want to learn more interesting Python project combat, you can go to learn Python small series of dress: a long time and their weapons while under a stream of thought (digital homonym) conversion can be found, there are new Python Tutorial Project

Guess you like

Origin www.cnblogs.com/chengxuyuanaa/p/11984955.html