Python Turtle Graphics Drawing - Android Logo
Source code:
from turtle import *
from math import radians,sin,cos
col='#3ADC87'
def drawantenna(sz):
color('red')
up()
fd(sz*0.8)
down()
color(col)
begin_fill()
rt(90)
fd(sz*0.03)
lt(90)
fd(sz*0.45)
circle(sz*0.03,180)
fd(sz*0.45)
lt(90)
fd(sz*0.03)
end_fill()
color('red')
up()
rt(90)
fd(sz*0.8)
def draweye(sz):
color('red')
up()
fd(0.65*sz)
rt(90)
fd(0.08*sz)
lt(90)
down()
color('white')
begin_fill()
circle(0.08*sz)
end_fill()
color('red')
up()
lt(90)
fd(0.08*sz)
lt(90)
fd(0.65*sz)
def drawlogo(sz):
up()
x = cos(radians(6))*sz
y = sin(radians(6))*sz
rt(90)
fd(0.25*sz)
lt(180)
fd(y)
rt(90)
down()
begin_fill()
fd(x)
lt(96)
circle(sz,180-12)
lt(96)
fd(x)
end_fill()
lt(60)
drawantenna(sz)
lt(180+60)
drawantenna(sz)
rt(30)
fd(y)
lt(90+45)
color('white')
draweye(sz)
rt(90)
draweye(sz)
color('black')
rt(45)
fd(0.5*sz+y)
fnt = ('Century Gothic', round(sz*0.4),'bold')
write('android', align='center', font=fnt)
setup(640, 640)
bgcolor('white')
color(col)
drawlogo(250)
hideturtle()
done()
No comments:
Post a Comment