The turtle painting mosquito python

Principle: using turtle draw a circle, and gradually increase the radius

  code show as below:

import turtle
turtle.pensize(30)
for i in range(30):
	turtle.circle(i*10,60)
turtle.done()

  The following code explanation

----1

import turtle

   Import library turtle, turtle python library is the basis for drawing library, which was introduced as one of the most commonly used to introduce children to programming knowledge library method, which is mainly used for design entry, is one of the standard library use turtle can make a lot of complex drawings. turtle name meaning "turtle", we imagine a turtle, right in the heart of the display window, walk on the canvas, its trajectory walk on the formation of graphics rendering. Turtle motion is controlled by a program, which can change color, change the size (width) and the like.

----2

turtle.pensize(30)

  Set the pen thickness

---3

for i in range(30):
	turtle.circle(i*10,60)

  Loop circle 30 times Videos 60 degrees and the radius 10 increases, that is 30 × 60 Videos circular degree, 1800 degree, i.e., turns 5

----4

turtle.done()

  After the unfinished, the panel stay, otherwise unfinished brush will automatically shut down, sublime editor I use, but the python IDLE editor that comes with such a situation does not arise

Finally: running results

 

Guess you like

Origin www.cnblogs.com/wangyongfengxiaokeai/p/11518757.html