【发布时间】:2018-08-24 13:20:56
【问题描述】:
除了绘制一个圆形并在其上绘制一个正方形之外,还有其他方法可以为方形/矩形添加圆边吗?我正在尝试仅使用 Python 龟制作 YouTube 徽标。我没有使用 home() 之类的绝对位置函数,因为稍后我需要在不同的位置复制它。
from turtle import *
def placement():
penup()
setheading(0)
forward(5)
setheading(90)
forward(20)
setheading(0)
pendown()
def youtube():
placement() #Custom Starting poisition
hideturtle()
pencolor("#d43b33") # Pen Color
fillcolor("#d43b33") #Youtube Red Colour RGB Code
begin_fill()
forward(90)
setheading(90) #Face Up
forward(30)
setheading(180) #Face Left
forward(90)
setheading(270) #Face Down
forward(30)
end_fill()
setheading(0) #Second Half Youtube Logo
forward(90)
setheading(90)
forward(30)
pencolor("#fa453b") # Pen Color
fillcolor("#fa453b") #Youtube Ligther Red Colour RGB Code
begin_fill()
forward(30)
setheading(180) # Face Left
forward(90)
setheading(270) #Face Down
forward(30)
setheading(0) #turn right
forward(90)
end_fill()
penup()
fillcolor("#ffffff") #Youtube White Play button RGB Code
setheading(180)
forward(55)
setheading(90)
begin_fill()
forward(20)
setheading(315)
forward(30)
setheading(225)
forward(30)
setheading(90)
forward(20)
end_fill()
【问题讨论】: