5. Cool labels
In this lesson we will learn how to work with labels. By the end of this lesson you will be able to print your name everywhere on the screen. Please clean the screen.
The label command is : label TEXT. Typing this will take the TEXT (a string) and print it on the screen in the direction in which the turtle is heading. Keep in mind that in order to print a text we have to first define the text with an open quotation mark. For example: “hello Write "turtle" to the screen.
Don't forget that in order to print a text we have to define a text with " sign like label "hello
We can control the font of our label. The command is : setlabelheight NUMBER. where NUMBER should be a positive number representing the font size. Set the font size to 30.
We will try to write the same label as before after setting the font to 30 in the previous step. Write “turtle” again, this time in font size 30.
Similar to step 2
In previous lessons we learned how to set the turtle head with the seth command. The direction of the label is the same as the direction of the head. Set the turtle head to 90 and write the label "turtle".
If we forgot how to use seth please look at previous lessons
seth 90 label "turtle
Now that we know how to control the label size and the label direction we can write a label wherever we want in the turtle's world. How will we do it? In previous lessons we learned how to set turtle position using setxy NUMBERX NUMBERY, and use penup and pendown when we don't want to draw anything. We will now lift the pen up and then set the new coordinates; put the pen down; and because we want to write from left to right we will set the head to 90 degrees and then write the label. Write “victory” from left to right starting at the (-30, 70) position.
If we didn't succeed we won't give up . we can see previous lessons about how to use the penup , setxy , pendown , seth commands
penup setxy -30 70 pendown seth 90 label "victory