Во-первых, я не верю, что логотип YouTube представляет собой скругленный прямоугольник , а скорее гиперэллипс .Но давайте предположим, что прямоугольник закруглен, чтобы все было просто.Во-вторых, я не верю, что ваши цвета и ваша стрелка соответствуют марке YouTube , поэтому я немного подправлю эти параметры:
from turtle import Turtle, Screen
def rounded_rectangle(turtle, short, long, radius):
diameter = radius * 2
heading = turtle.heading()
turtle.setheading(270)
isdown = turtle.isdown()
if isdown:
turtle.penup()
turtle.goto(turtle.xcor() - long/2, turtle.ycor() - short/2 + radius)
turtle.pendown()
for _ in range(2):
turtle.circle(radius, 90)
turtle.forward(long - diameter)
turtle.circle(radius, 90)
turtle.forward(short - diameter)
turtle.penup() # restore turtle state, position and heading
turtle.goto(turtle.xcor() + long/2, turtle.ycor() + short/2 - radius)
if isdown:
turtle.pendown()
turtle.setheading(heading)
def youtube(turtle):
turtle.color("#ff0000") # YouTube red pen color RGB code
turtle.begin_fill()
rounded_rectangle(turtle, 60, 90, 10)
turtle.end_fill()
turtle.penup()
turtle.color("#ffffff") # YouTube white play button RGB code
turtle.setheading(0)
turtle.backward(8)
turtle.setheading(90)
turtle.pendown()
turtle.begin_fill()
turtle.forward(12)
for _ in range(2):
turtle.right(120)
turtle.forward(24)
turtle.right(120)
turtle.forward(12)
turtle.end_fill()
def placement(turtle):
turtle.penup()
turtle.forward(5)
turtle.left(90)
turtle.forward(20)
turtle.right(90)
turtle.pendown()
screen = Screen()
yertle = Turtle(visible=False)
placement(yertle) # Custom starting position
youtube(yertle)
screen.mainloop()
![enter image description here](https://i.stack.imgur.com/WUFee.png)