Page 26 - 2501_KVS_C-6
P. 26

Aryan: Well… I think by now you have become familiar with most of the working of the turtle
                      environment, canvas, pen and drawing shapes, filling them with any color etc. So, let me ask you
                      something:
                  Suppose you want to do the following with your turtle:
                              Change pen color to red
                          Ø
                              Change fill color to green
                          Ø
                              Change pen size to 10 (width of outline)
                          Ø
                              Change pen speed to 4
                          Ø
                      Gowri: Can you write the code?
                      Aryan: Yes..I can.. It will be:
                          Turtle.pencolor(“red”)

                          Turtle.fillcolor(“green”)

                          Turtle.pensize(10)
                          Turtle.speed(4)

                  Am I correct?

                      Gowri: Yes..but you can use just one line of code instead of these all by using
                              Turtle.pen(pencolor=”red”, fillcolor=”green”, pensize=10, speed=4)
                      Aryan: Sorry  ..I am not able to understand it..

                      Gowri: No issues..I will give an example to make things more clear to you..
























                  Observe the pen size and other things that are written in bracket and compare them with
                  the result that is here..It is very easy to do.

                  1.10 CLONING THE TURTLE

                      Gowri:  Do you know, We can create clone ( similar copy ) of a turtle by using clone() function – it
                              creates an exactly same copy of the pen at the same position. It can be used when we
                              want to have two or more copies of the turtle on the same drawing screen.


                24                         KVS DELHI REGION 2025
   21   22   23   24   25   26   27   28   29   30   31