Page 25 - 2501_KVS_C-6
P. 25

Is it not something that you were imagining?
                 You can change the pen turtle to these shapes of your choice:

                            turtle
                       ü
                            arrow
                       ü
                            circle
                       ü
                            square
                       ü
                            triangle
                       ü
                 Use the following syntax to change the shape:
                 pen.shape("shape name")

                 e.g. In above program name of my turtle(pen) is pen so I have used pen.shape(“turtle”)
                         Original shape of the turtle is referred to as classic, so to get back the original
                     Ø
                         shape we may use:
                             turtle.shape(“classic”)
                         Ø

                 1.9  UNDERSTANDING SPEED OF THE TURTLE AND
                      DIFFERENT PARAMETERS IN PEN FUNCTION
                 Let me tell you something more interesting.. the turtle pen speed can also be changed if you
                 think it is moving slow/fast.

                 Turtle.speed(n) – To increase/decrease the speed of the turtle while drawing.
                 The n given in bracket can be any number between 0 and 10 where 0 means the slowest
                 speed and 10 means the highest speed.

                 Gowri:Try this code and feel the difference in speed of the turtle.

                          import turtle
                          Scr = turtle.Screen()

                          pen = turtle.Turtle()
                          pen.shape("turtle")

                          pen.speed(1)
                          pen.fd(100)

                          pen.rt(90)

                          pen.speed(5)
                          pen.fd(100)

                          pen.rt(90)
                          pen.speed(10)

                          pen.fd(100)
                 Hope you found it interesting..?



                                                                                 Python Turtle                      23
   20   21   22   23   24   25   26   27   28   29   30