turtle - Turtle graphics - Python 3.9.2 documentation
[Python3] 파이썬 거북이 그래픽 (Python Turtle Graphics) 모듈 사용하기 - 그림 그리기
Python 터틀 그래픽 - 제6강 turtle 모듈 명령어 정리
from turtle import *
color('red', 'yellow')
begin_fill()
while True:
forward(200)
left(170)
if abs(pos()) < 1:
break
end_fill()
done()
import turtle
turtle.speed(0)
turtle.bgcolor("black")
turtle.pencolor("white")
turtle.colormode(255)
def draw_polygon(n):
line_length = 50
ex_angle = 360/n
for i in range(n):
turtle.forward(line_length)
turtle.left(ex_angle)
for i in range(18, 2, -1):
red = 0
green = 255 -17 * (i-3)
blue = 17 * (i-3)
turtle.color(0, green, blue)
turtle.begin_fill()
draw_polygon(i)
turtle.end_fill()
turtle.hideturtle()
turtle.done()
import turtle
turtle.speed(0)
turtle.bgcolor("black")
turtle.pencolor("white")
turtle.colormode(255)
turtle.tracer(3)
def draw_polygon(n):
line_length = 20
ex_angle = 360/n
for i in range(n):
turtle.forward(line_length)
turtle.left(ex_angle)
for i in range(54, 2, -1):
red = 255
green = 255 - 5 * (i-3)
blue = 0
turtle.color(red, green, blue)
turtle.begin_fill()
draw_polygon(i)
turtle.end_fill()
turtle.hideturtle()
turtle.update()
turtle.done()