학습 목표
수업 자료
[1]단계 . 윈도우 마크 따라 그려보기
•
사각형 그리기 코드
•
4각형 2개 그리기(중간 간격)
•
4각형 4번 반복(중간에 색만 바꾸기)
from turtle import *
color("green")
begin_fill()S
for ii in range(4):
fd(100)
left(90)
end_fill()
right(90)
penup()
fd(30)
pendown()
color("yellow")
begin_fill()
for ii in range(4):
fd(100)
left(90)
end_fill()
right(90)
penup()
fd(30)
pendown()
color("blue")
begin_fill()
for ii in range(4):
fd(100)
left(90)
end_fill()
right(90)
penup()
fd(30)
pendown()
color("red")
begin_fill()
for ii in range(4):
fd(100)
left(90)
end_fill()
right(90)
penup()
fd(30)
pendown()
done()
JavaScript
복사
[2]단계 . 다양한 터틀 프로젝트 예제 코드 살펴보기
•
랜덤 원형 그리기
from turtle import *
import random as r
Turtle()
colormode(255)
width(5)
speed(20)
for ii in range(100) :
x = r.randint(-400, 400)
y = r.randint(-400, 400)
red = r.randint(0, 255)
green = r.randint(0, 255)
blue = r.randint(0, 255)
color(red, green, blue)
size = r.randint(10, 100)
penup()
goto(x, y)
pendown()
begin_fill()
circle(size)
end_fill()
JavaScript
복사
•
컬러플 스파이럴
# 두 번째 예제: 컬러풀한 스파이럴 그리기
from turtle import *
import random as r
Turtle()
colormode(255)
width(2)
speed(20)
for i in range(100):
red = r.randint(0, 255)
green = r.randint(0, 255)
blue = r.randint(0, 255)
color(red, green, blue)
forward(i * 2)
right(91)
done()
JavaScript
복사
•
밤하늘의 별
# 세 번째 예제: 랜덤한 위치에 별 모양 그리기
from turtle import *
import random as r
Turtle()
colormode(255)
width(2)
speed(20)
bgcolor('black')
for i in range(30):
x = r.randint(-300, 300)
y = r.randint(-300, 300)
red = r.randint(150, 255)
green = r.randint(150, 255)
blue = r.randint(150, 255)
color(red, green, blue)
size = r.randint(10, 50)
penup()
goto(x, y)
pendown()
begin_fill()
for ii in range(5):
forward(size)
right(144)
end_fill()
done()
JavaScript
복사
•
간단한 집 모양
# 간단한 집 모양 그리기
from turtle import *
import random as r
Turtle()
colormode(255)
width(5)
speed(20)
# 집의 본체 그리기
penup()
goto(-100, -100)
pendown()
color(150, 75, 0) # 갈색 (집의 본체 색상)
begin_fill()
for _ in range(4):
forward(200)
left(90)
end_fill()
# 지붕 그리기
penup()
goto(-100, 100)
pendown()
color(255, 0, 0) # 빨간색 (지붕 색상)
begin_fill()
forward(200)
left(135)
forward(141)
left(90)
forward(141)
end_fill()
done()
JavaScript
복사
•
간단한 스마일 모양
# 간단한 사람 얼굴 그리기
from turtle import *
Turtle()
colormode(255)
width(3)
speed(10)
# 얼굴 그리기 (노란색 원)
penup()
goto(0, -100)
pendown()
color(255, 224, 102) # 밝은 노란색
begin_fill()
circle(100)
end_fill()
# 왼쪽 눈 그리기 (검은색 원)
penup()
goto(-35, 20)
pendown()
color(0, 0, 0) # 검은색
begin_fill()
circle(10)
end_fill()
# 오른쪽 눈 그리기 (검은색 원)
penup()
goto(35, 20)
pendown()
begin_fill()
circle(10)
end_fill()
# 입 그리기 (빨간색 호)
penup()
goto(-40, -20)
pendown()
color(255, 0, 0) # 빨간색
width(5)
setheading(-60)
circle(50, 120)
done()
JavaScript
복사
[3]단계 . 나만의 그림 그리고 패들렛에 제출하기
•
위 코드를 참고하여 나만의 그림을 그리고 노션에 기록하자
•
패들렛에는 아래 과제 제출 자료 참고하여 그림과 노션링크를 제출한다.
3단계 까지 코드 작성 다한 친구들은 본인의 노션 페이지이 오늘 배운 내용을 정리 해 봅시다.
결과 제출 방법 안내
•
작성자 : 상암고 교사 성원경
•
업데이트 날짜 : 24년 9월19일
•
문의 : wonking710@naver.com
긴급시 연락(오픈카톡 링크 및 QR) :