터틀 그래픽으로는 여러가지 모양의 그림을 그릴 수 있다. 간단한 코드로 별, 하트 꽃 등 원하는 그림을 그릴 수 있도록 터틀 그래픽에서는 지원을 하고 있다.
Table of Contents
터틀 그래픽으로 다양한 모양 만들기
1. 별 그리기
![[파이썬] 다양한 모양 만들기(터틀 그래픽) 2 star](https://www.shindeacon.co.kr/wp-content/uploads/2023/10/star-optimized.png)
from turtle import *
color('black','yellow')
pensize(6)
begin_fill()
for x in range(5):
forward(200)
right(144)
end_fill()
mainloop()
2. 하트 그리기
![[파이썬] 다양한 모양 만들기(터틀 그래픽) 3 heart](https://www.shindeacon.co.kr/wp-content/uploads/2023/10/heart-optimized.png)
from turtle import *
color('black','red')
pensize(6)
begin_fill()
left(50)
forward(133)
circle(50,200)
right(140)
circle(50,200)
forward(133)
end_fill()
mainloop()
3. 하트 그리기 (다른버전)
import turtle
t = turtle.Turtle()
t.color('red')
t.begin_fill()
t.left(50)
t.forward(133)
t.circle(50, 200)
t.right(140)
t.circle(50, 200)
t.forward(133)
t.end_fill()
turtle.done()