Page 46 - 파이썬으로 배우는 컴퓨팅사고 도서 미리보기
P. 46

230  PART 2? 파이썬으로 익히는 STEAM 코딩

     3.	 9.2.1 소절의 (5) 본문에서 실습한 예제를 이용하여 shape() 함수를 통해 “arrow”, “turtle”,
          “circle”, “square”, “triangle”, “classic”을 순서대로 변경한다. 그리고 addshape()
          함수와 shape() 함수를 통해 “7s0.gif”, “7s1.gif”를 순서대로 등록하고 변경한다.

              import turtle as t
              t.setup(400, 400)
              t.delay(1000)
              t.shape(“arrow”)
              t.delay(1000)
              t.shape(“turtle”)
              t.delay(1000)
              t.shape(“circle”)
              t.delay(1000)
              t.shape(“square”)
              t.delay(1000)
              t.shape(“triangle”)
              t.delay(1000)
              t.shape(“classic”)
              t.delay(1000)
              t.addshape(“7s0.gif”)
              t.shape(“7s0.gif”)
              t.delay(1000)
              t.addshape(“7s1.gif”)
              t.shape(“7s1.gif”)

               실행결과
   41   42   43   44   45   46   47   48   49   50   51