1. 程式人生 > >python使用turtle庫繪製奧運五環

python使用turtle庫繪製奧運五環

效果圖:
#奧運五環
import turtle
turtle.setup(1.0,1.0)    #設定視窗大小
turtle.title("奧運五環")
#藍圓
turtle.penup()
turtle.right(90)
turtle.forward(-50)
turtle.left(90)
turtle.forward(-200)
turtle.pendown()
turtle.pensize(10)
turtle.color("blue")
turtle.circle(100)
#黑圓
turtle.penup()
turtle.forward(250)
turtle.pendown()
turtle.pensize(10)
turtle.color("black")
turtle.circle(100)
#紅圓
turtle.penup()
turtle.forward(250)
turtle.pendown()
turtle.pensize(10)
turtle.color("red")
turtle.circle(100)
#黃圓
turtle.penup()
turtle.forward(-275)
turtle.right(-90)
turtle.pendown()
turtle.pensize(10)
turtle.color("yellow")
turtle.circle(100)
#綠圓
turtle.penup()
turtle.left(-90)
turtle.forward(50)
turtle.right(90)
turtle.pendown()
turtle.pensize(10)
turtle.color("green")
turtle.circle(100)

 嗨,歡迎大家掃碼關注本人公眾號,會經常分享一些程式設計例項以及一些資源喔!

 

 

&n