Python Turtle Graphics Drawing - Chrome Logo
Source code:
import turtle as t
from math import sqrt
t.setup(640,640)
t.bgcolor('white')
t.tracer(1)
R = 310
# equilateral triangle
a = R/2
L = sqrt(R**2-a**2)
colors = ['#FBBF03', '#E4382A', '#269E49']
blu = '#1374E9'
for i in range(3):
t.color(colors[i])
t.up()
t.lt(90)
t.fd(a)
t.down()
t.begin_fill()
t.rt(90)
t.fd(L)
t.rt(60)
t.circle(-R,120)
t.rt(120)
t.fd(L)
t.circle(a,120)
t.end_fill()
t.up()
t.lt(90)
t.fd(a)
t.lt(90)
t.lt(120)
r = R/2-R/10
t.fd(r)
t.lt(90)
t.down()
t.color(blu)
t.begin_fill()
t.circle(r)
t.end_fill()
t.hideturtle()
t.done()
No comments:
Post a Comment