turtle模块画奥运五环

import turtle
import os

turtle.width(10)  #设置线条粗细

turtle.penup()
turtle.backward(140)
turtle.pendown()

turtle.color('blue')
turtle.circle(50)

turtle.penup()
# turtle.goto(0,0)
turtle.forward(120)
turtle.pendown()

turtle.color('black')
turtle.circle(50)
#
turtle.penup()
# turtle.goto(240,0)
turtle.forward(120)
turtle.pendown()

turtle.color('red')
turtle.circle(50)
#
turtle.penup()
turtle.goto(-80,-50)
turtle.pendown()
#
turtle.color('yellow')
turtle.circle(50)
#
turtle.penup()
turtle.goto(40,-50)
turtle.pendown()

turtle.color('green')
turtle.circle(50)


#退出窗口的解决办法
# os.system('pause')
# turtle.exitonclick()  #等待用户点击界面才退出
# turtle.mainloop()  #该句后面的所有代码都无法执行
turtle.done()  #功能和mainloop差不多

结果如图所示:


image.png

你可能感兴趣的:(turtle模块画奥运五环)