프로그램
[파이썬] 문제 : 얼굴 그리기
오디세이99
2023. 6. 14. 00:36
728x90
반응형
import turtle
t = turtle.Turtle()
t.speed(0)
t.hideturtle() # 펜모얄 숨기기
t.pensize(14) # 펜 굵기
def move(x, y): # 이동 함수
t.penup()
t.goto(x, y)
t.pendown()
r = 100 # 바깥 회전 반원 그리기
t.fillcolor('white')
t.begin_fill()
for i in range(7):
t.circle(r, 180)
t.right(128.5)
t.end_fill()
move(-200, -70) # 노랑 얼굴 그리기
t.fillcolor('yellow')
t.begin_fill()
t.circle(180)
t.end_fill()
move(-250, 180) # 왼쪽 눈 그리기
t.fillcolor('black')
t.begin_fill()
t.circle(10)
t.end_fill()
move(-150, 180) # 오른쪽 눈 그리기
t.fillcolor('black')
t.begin_fill()
t.circle(10)
t.end_fill()
r = 100 # 입 그리기
move(-300, 100)
t.right(90)
t.circle(r, 180)
turtle.done()
try:
turtle.bye()
except:
print("bye")

728x90
반응형