python海龟绘图-奥运五环

import turtle #导入turtle模块
# This is a square!
def square():#定义函数
   turtle.width(10)#整体宽度
   turtle.color("red") #定义颜色
   turtle.circle(50)   #画直接五十码的圆
   turtle.penup() #抬笔
   turtle.goto(120,0)#去坐标120,0
   turtle.pendown()#下笔
   turtle.color("green")
   turtle.circle(50)
   turtle.penup()
   turtle.goto(240,0)
   turtle.pendown()
   turtle.color("black")
   turtle.circle(50)
   turtle.penup()
   turtle.color("yellow")
   turtle.goto(60,-60)
   turtle.pendown()
   turtle.circle(50)
   turtle.penup()
   turtle.goto(180,-60)
   turtle.pendown()
   turtle.color("blue")
   turtle.circle(50)
square()

python海龟绘图-奥运五环_第1张图片

你可能感兴趣的:(学习分享,python)